diff mbox

HS 2.0R2: Add password to DB from OSU SPP server in case of machine managed subscription

Message ID CAM3HuXS3u2goFG_8NOkUSybg8zXwicUXj+Dc5LdeR8yxb3RSLg@mail.gmail.com
State Accepted
Headers show

Commit Message

Sreenath S April 10, 2014, 10:46 a.m. UTC
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 <sreenath.mailing.lists@gmail.com>
---
 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

Comments

Sreenath S April 21, 2014, 10:10 a.m. UTC | #1
Hi Jouni,

Any update regarding this patch?

Regards,
Sreenath

On 10 April 2014 16:16, Sreenath S <sreenath.mailing.lists@gmail.com> wrote:
> 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 <sreenath.mailing.lists@gmail.com>
> ---
>  hs20/server/spp_server.c |   25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> 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,
>         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
Jouni Malinen Feb. 1, 2015, 8:49 p.m. UTC | #2
On Thu, Apr 10, 2014 at 04:16:45PM +0530, Sreenath S wrote:
> 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.

Thanks, applied.
diff mbox

Patch

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,