From patchwork Wed Apr 1 00:14:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 457050 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 6A078140077 for ; Wed, 1 Apr 2015 11:15:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 40E7E9D309; Tue, 31 Mar 2015 20:15:44 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gP63Uqj6YMFA; Tue, 31 Mar 2015 20:15:44 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9DC999D428; Tue, 31 Mar 2015 20:15:09 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 984629D3FC for ; Tue, 31 Mar 2015 20:14:51 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3My51Dt2PlHt for ; Tue, 31 Mar 2015 20:14:38 -0400 (EDT) Received: from mail2.candelatech.com (mail2.candelatech.com [208.74.158.173]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id E16F117C04F for ; Tue, 31 Mar 2015 20:14:37 -0400 (EDT) Received: from localhost.localdomain (unknown [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 5BD4640E9B4; Tue, 31 Mar 2015 17:14:37 -0700 (PDT) From: greearb@candelatech.com To: hostap@lists.shmoo.com Subject: [PATCH-v2 2/4] hs20-client: use configured ca-fname instead of cwd. Date: Tue, 31 Mar 2015 20:14:18 -0400 Message-Id: <1427847260-1967-2-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1427847260-1967-1-git-send-email-greearb@candelatech.com> References: <1427847260-1967-1-git-send-email-greearb@candelatech.com> Cc: j@w1.fi, Ben Greear X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Ben Greear This gives more flexibility to the hs20 client user. Signed-off-by: Ben Greear --- hs20/client/osu_client.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c index 649a884..c3d00c0 100644 --- a/hs20/client/osu_client.c +++ b/hs20/client/osu_client.c @@ -2036,11 +2036,19 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid, if (set_network_quoted(ifname, id, "ssid", ssid) < 0) return -1; if (osu_nai && os_strlen(osu_nai) > 0) { - char dir[255], fname[300]; - if (getcwd(dir, sizeof(dir)) == NULL) - return -1; - os_snprintf(fname, sizeof(fname), "%s/osu-ca.pem", dir); + char fname[300]; + if (ctx->ca_fname) { + strncpy(fname, ctx->ca_fname, sizeof(fname)); + } + else { + char dir[255]; + if (getcwd(dir, sizeof(dir)) == NULL) + return -1; + os_snprintf(fname, sizeof(fname), "%s/osu-ca.pem", dir); + ctx->ca_fname = strdup(fname); /* so lib curl can use it. */ + } + fname[sizeof(fname) - 1] = 0; /* ensure null termination */ if (set_network(ifname, id, "proto", "OSEN") < 0 || set_network(ifname, id, "key_mgmt", "OSEN") < 0 || set_network(ifname, id, "pairwise", "CCMP") < 0 ||