From patchwork Thu Apr 10 10:46:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreenath S X-Patchwork-Id: 338088 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]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 804A61400DB for ; Thu, 10 Apr 2014 20:47:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7AE3C9C1AD; Thu, 10 Apr 2014 06:46:58 -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 mSGIby5axcxi; Thu, 10 Apr 2014 06:46:58 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B1D5E9C1A0; Thu, 10 Apr 2014 06:46:53 -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 96F079C1A0 for ; Thu, 10 Apr 2014 06:46:52 -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 2rLzWUYfSRKH for ; Thu, 10 Apr 2014 06:46:45 -0400 (EDT) Received: from mail-qa0-f50.google.com (mail-qa0-f50.google.com [209.85.216.50]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id D9DFA9C18E for ; Thu, 10 Apr 2014 06:46:45 -0400 (EDT) Received: by mail-qa0-f50.google.com with SMTP id ih12so3661510qab.37 for ; Thu, 10 Apr 2014 03:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=89/YWaIoWQfNquFu0JIYgw/Q2fOhhomjhM+6y08JBB8=; b=WJOUC7SpuZiKEmcVzvHJUm2DXT9ZVHEHgrYtTE5FCMnaimYfawc6oBkxVVQUnKRSNn /R3v2oxzsTrV4Ltp0nbD4R7g4gkmMyu5gbcCqp+08pc1J6xw/nrsnoCGDL7kaIMxYklH MSXd6txWppW1tjuPhDfWQyXViWkM/vusy/bxnnT3areKK4ihVZjFdMdwJ2zrHb6/99/l 7fxZS3Q6/MLvahgKWH8KgGbIaRaegw50HcnDXJFQllwuriujZ/DvKZvkVOhJzd8I7sD+ ZPp1IIM/m9XxaAHpVbefe25UOi9X8iDSlBF2TBHiIcqAD6es4lUz/6cKEfsCsqJEqu8/ WHlQ== MIME-Version: 1.0 X-Received: by 10.140.104.202 with SMTP id a68mr981591qgf.113.1397126805239; Thu, 10 Apr 2014 03:46:45 -0700 (PDT) Received: by 10.224.35.3 with HTTP; Thu, 10 Apr 2014 03:46:45 -0700 (PDT) Date: Thu, 10 Apr 2014 16:16:45 +0530 Message-ID: Subject: [PATCH] HS 2.0R2: Add password to DB from OSU SPP server in case of machine managed subscription From: Sreenath S To: hostap@lists.shmoo.com 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: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Add password and machine_managed flag to database in case of machine managed subscription to fix EAP-TTLS connection failure to production AP. In case of user managed subscription, the entered password is added to DB from the PHP script. However in machine managed subscription, machine generated password is added only in SOAP messages and PPS MO. So connection to production will fail as the generated password is not present in the database used by AAA server. Signed-off-by: Sreenath Sharma --- hs20/server/spp_server.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) xml_node_t *node) @@ -1378,6 +1398,11 @@ static xml_node_t * hs20_user_input_registration(struct hs20_svc *ctx, debug_print(ctx, 1, "Request DB subscription registration on success " "notification"); + if (machine_managed) { + db_update_session_password(ctx, user, realm, session_id, pw); + db_update_session_machine_managed(ctx, user, realm, session_id, + machine_managed); + } db_add_session_pps(ctx, user, realm, session_id, pps); hs20_eventlog_node(ctx, user, realm, session_id, -- 1.7.9.5 diff --git a/hs20/server/spp_server.c b/hs20/server/spp_server.c index 4d77d0e..5f11fd7 100644 --- a/hs20/server/spp_server.c +++ b/hs20/server/spp_server.c @@ -103,6 +103,26 @@ static void db_update_session_password(struct hs20_svc *ctx, const char *user, } +static void db_update_session_machine_managed(struct hs20_svc *ctx, + const char *user, const char *realm, + const char *sessionid, const int pw_mm) +{ + char *sql; + + sql = sqlite3_mprintf("UPDATE sessions SET machine_managed=%Q WHERE " + "id=%Q AND user=%Q AND realm=%Q", + pw_mm ? "1" : "0", sessionid, user, realm); + if (sql == NULL) + return; + debug_print(ctx, 1, "DB: %s", sql); + if (sqlite3_exec(ctx->db, sql, NULL, NULL, NULL) != SQLITE_OK) { + debug_print(ctx, 1, "Failed to update session machine_managed: %s", + sqlite3_errmsg(ctx->db)); + } + sqlite3_free(sql); +} + + static void db_add_session_pps(struct hs20_svc *ctx, const char *user, const char *realm, const char *sessionid,