gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-35


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-351-g799eb2e
Date: Mon, 26 Dec 2011 21:29:42 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  799eb2e1caa97d280935193bb2c1157d224bc245 (commit)
       via  98a874664127384f0975390174d191ede7ca51a4 (commit)
      from  a4192c40a2bee9dbc60b461761e958dccfdca1b4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=799eb2e1caa97d280935193bb2c1157d224bc245


commit 799eb2e1caa97d280935193bb2c1157d224bc245
Author: Pawel Kot <address@hidden>
Date:   Mon Dec 26 22:26:46 2011 +0100

    Simplify auth callback interface.
    
    Now callback is responsible only for getting PIN (or any other security
    code) from user.  Calling libgnokii functions are done within libgnokii.
    
    Fix again the logic of parsing the return code from
    GN_OP_GetSecurityCodeStatus.
    
    Exported function should be defined with GNOKII_API.

diff --git a/common/gsm-auth.c b/common/gsm-auth.c
index 43fdf92..87301c9 100644
--- a/common/gsm-auth.c
+++ b/common/gsm-auth.c
@@ -73,7 +73,7 @@ static gn_error auth_pin_interactive(gn_data *data, struct 
gn_statemachine *stat
        default:
                return GN_ERR_NOTSUPPORTED;
        }
-       return gn_sm_functions(GN_OP_EnterSecurityCode, data, state);
+       return GN_ERR_NONE;
 }
 
 /*
@@ -128,12 +128,27 @@ static int read_security_code_from_file(const char *path, 
gn_security_code *sc)
        return cnt;
 }
 
-static gn_error auth_pin(gn_auth_type auth_type, struct gn_statemachine *state)
+static gn_error auth_pin(gn_auth_type auth_type, gn_data *data, struct 
gn_statemachine *state)
+{
+       gn_error err = GN_ERR_NONE;
+       const char *path = state->config.auth_file;
+
+       if (!read_security_code_from_file(path, data->security_code)) {
+               if (auth_type != GN_AUTH_TYPE_NONINTERACTIVE) {
+                       dprintf("Falling back to interactive mode.\n");
+                       err = auth_pin_interactive(data, state);
+               } else {
+                       err = GN_ERR_NOTAVAILABLE;
+               }
+       }
+       return err;
+}
+
+gn_error do_auth(gn_auth_type auth_type, struct gn_statemachine *state)
 {
        gn_error err;
        gn_data *data;
        gn_security_code sc;
-       const char *path = state->config.auth_file;
 
        data = calloc(1, sizeof(gn_data));
        data->security_code = &sc;
@@ -148,8 +163,9 @@ static gn_error auth_pin(gn_auth_type auth_type, struct 
gn_statemachine *state)
         * inserted (we cannot distinguish here between these three
         * situations), gnokii is still usable.
         */
-       if (err == GN_ERR_NONE || err == GN_ERR_SIMPROBLEM) {
-               err = GN_ERR_NONE;
+       if (err != GN_ERR_NONE) {
+               if (err == GN_ERR_SIMPROBLEM)
+                       err = GN_ERR_NONE;
                goto out;
        }
 
@@ -169,42 +185,33 @@ static gn_error auth_pin(gn_auth_type auth_type, struct 
gn_statemachine *state)
                goto out;
        }
 
-       if (!read_security_code_from_file(path, data->security_code)) {
-               if (auth_type != GN_AUTH_TYPE_NONINTERACTIVE) {
-                       dprintf("Falling back to interactive mode.\n");
-                       err = auth_pin_interactive(data, state);
-               } else {
-                       err = GN_ERR_NOTAVAILABLE;
-               }
-               goto out;
-       }
-
-       err = gn_sm_functions(GN_OP_EnterSecurityCode, data, state);
-out:
-       free(data);
-       return err;
-}
-
-gn_error do_auth(gn_auth_type auth_type, struct gn_statemachine *state)
-{
        switch (auth_type) {
        case GN_AUTH_TYPE_TEXT:
-               return auth_pin(auth_type, state);
+               err = auth_pin(auth_type, data, state);
+               break;
        case GN_AUTH_TYPE_INTERACTIVE:
        case GN_AUTH_TYPE_NONINTERACTIVE:
                if (!state->callbacks.auth_interactive)
-                       return auth_pin(auth_type, state);
+                       err = auth_pin(auth_type, data, state);
                else
-                       return state->callbacks.auth_interactive(state);
+                       err = state->callbacks.auth_interactive(data, state);
+               break;
        case GN_AUTH_TYPE_NONE:
        case GN_AUTH_TYPE_BINARY:
-               return GN_ERR_NONE;
+               err = GN_ERR_NONE;
+               break;
        default:
-               return GN_ERR_NOTSUPPORTED;
+               err = GN_ERR_NOTSUPPORTED;
+               break;
        }
+       if (err == GN_ERR_NONE)
+               err = gn_sm_functions(GN_OP_EnterSecurityCode, data, state);
+out:
+       free(data);
+       return err;
 }
 
-void gn_auth_interactive_register(gn_auth_interactive_func_t auth_func, struct 
gn_statemachine *state)
+GNOKII_API void gn_auth_interactive_register(gn_auth_interactive_func_t 
auth_func, struct gn_statemachine *state)
 {
        state->callbacks.auth_interactive = auth_func;
 }
diff --git a/include/gnokii/data.h b/include/gnokii/data.h
index 4cc248f..c94b5d2 100644
--- a/include/gnokii/data.h
+++ b/include/gnokii/data.h
@@ -165,7 +165,7 @@ typedef void (*gn_call_notification_func_t)(gn_call_status 
call_status, gn_call_
 typedef void (*gn_rlp_rx_callback_func_t)(gn_rlp_f96_frame *frame);
 typedef void (*gn_reg_notification_func_t)(gn_network_info *info, void 
*callback_data);
 typedef void (*gn_progress_indication_func_t)(int progress, void 
*callback_data);
-typedef gn_error (*gn_auth_interactive_func_t)(struct gn_statemachine *state);
+typedef gn_error (*gn_auth_interactive_func_t)(gn_data *data, struct 
gn_statemachine *state);
 typedef struct {
        gn_on_sms_func_t on_sms;
        gn_on_cell_broadcast_func_t on_cell_broadcast;
@@ -181,6 +181,12 @@ typedef struct {
         * progress is value in range [0, 100].
         */
        gn_progress_indication_func_t progress_indication;
+       /*
+        * data->security_code->type contains the type of the security code to 
be entered.
+        * You need to put the code into data->security_code->code and return 
GN_ERR_NONE.
+        * If any other return code will be returned the authentication 
information won't be
+        * sent to the phone.
+        */
        gn_auth_interactive_func_t auth_interactive;
 } gn_callback;
 

http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=98a874664127384f0975390174d191ede7ca51a4


commit 799eb2e1caa97d280935193bb2c1157d224bc245
Author: Pawel Kot <address@hidden>
Date:   Mon Dec 26 22:26:46 2011 +0100

    Simplify auth callback interface.
    
    Now callback is responsible only for getting PIN (or any other security
    code) from user.  Calling libgnokii functions are done within libgnokii.
    
    Fix again the logic of parsing the return code from
    GN_OP_GetSecurityCodeStatus.
    
    Exported function should be defined with GNOKII_API.

diff --git a/common/gsm-auth.c b/common/gsm-auth.c
index 43fdf92..87301c9 100644
--- a/common/gsm-auth.c
+++ b/common/gsm-auth.c
@@ -73,7 +73,7 @@ static gn_error auth_pin_interactive(gn_data *data, struct 
gn_statemachine *stat
        default:
                return GN_ERR_NOTSUPPORTED;
        }
-       return gn_sm_functions(GN_OP_EnterSecurityCode, data, state);
+       return GN_ERR_NONE;
 }
 
 /*
@@ -128,12 +128,27 @@ static int read_security_code_from_file(const char *path, 
gn_security_code *sc)
        return cnt;
 }
 
-static gn_error auth_pin(gn_auth_type auth_type, struct gn_statemachine *state)
+static gn_error auth_pin(gn_auth_type auth_type, gn_data *data, struct 
gn_statemachine *state)
+{
+       gn_error err = GN_ERR_NONE;
+       const char *path = state->config.auth_file;
+
+       if (!read_security_code_from_file(path, data->security_code)) {
+               if (auth_type != GN_AUTH_TYPE_NONINTERACTIVE) {
+                       dprintf("Falling back to interactive mode.\n");
+                       err = auth_pin_interactive(data, state);
+               } else {
+                       err = GN_ERR_NOTAVAILABLE;
+               }
+       }
+       return err;
+}
+
+gn_error do_auth(gn_auth_type auth_type, struct gn_statemachine *state)
 {
        gn_error err;
        gn_data *data;
        gn_security_code sc;
-       const char *path = state->config.auth_file;
 
        data = calloc(1, sizeof(gn_data));
        data->security_code = &sc;
@@ -148,8 +163,9 @@ static gn_error auth_pin(gn_auth_type auth_type, struct 
gn_statemachine *state)
         * inserted (we cannot distinguish here between these three
         * situations), gnokii is still usable.
         */
-       if (err == GN_ERR_NONE || err == GN_ERR_SIMPROBLEM) {
-               err = GN_ERR_NONE;
+       if (err != GN_ERR_NONE) {
+               if (err == GN_ERR_SIMPROBLEM)
+                       err = GN_ERR_NONE;
                goto out;
        }
 
@@ -169,42 +185,33 @@ static gn_error auth_pin(gn_auth_type auth_type, struct 
gn_statemachine *state)
                goto out;
        }
 
-       if (!read_security_code_from_file(path, data->security_code)) {
-               if (auth_type != GN_AUTH_TYPE_NONINTERACTIVE) {
-                       dprintf("Falling back to interactive mode.\n");
-                       err = auth_pin_interactive(data, state);
-               } else {
-                       err = GN_ERR_NOTAVAILABLE;
-               }
-               goto out;
-       }
-
-       err = gn_sm_functions(GN_OP_EnterSecurityCode, data, state);
-out:
-       free(data);
-       return err;
-}
-
-gn_error do_auth(gn_auth_type auth_type, struct gn_statemachine *state)
-{
        switch (auth_type) {
        case GN_AUTH_TYPE_TEXT:
-               return auth_pin(auth_type, state);
+               err = auth_pin(auth_type, data, state);
+               break;
        case GN_AUTH_TYPE_INTERACTIVE:
        case GN_AUTH_TYPE_NONINTERACTIVE:
                if (!state->callbacks.auth_interactive)
-                       return auth_pin(auth_type, state);
+                       err = auth_pin(auth_type, data, state);
                else
-                       return state->callbacks.auth_interactive(state);
+                       err = state->callbacks.auth_interactive(data, state);
+               break;
        case GN_AUTH_TYPE_NONE:
        case GN_AUTH_TYPE_BINARY:
-               return GN_ERR_NONE;
+               err = GN_ERR_NONE;
+               break;
        default:
-               return GN_ERR_NOTSUPPORTED;
+               err = GN_ERR_NOTSUPPORTED;
+               break;
        }
+       if (err == GN_ERR_NONE)
+               err = gn_sm_functions(GN_OP_EnterSecurityCode, data, state);
+out:
+       free(data);
+       return err;
 }
 
-void gn_auth_interactive_register(gn_auth_interactive_func_t auth_func, struct 
gn_statemachine *state)
+GNOKII_API void gn_auth_interactive_register(gn_auth_interactive_func_t 
auth_func, struct gn_statemachine *state)
 {
        state->callbacks.auth_interactive = auth_func;
 }
diff --git a/include/gnokii/data.h b/include/gnokii/data.h
index 4cc248f..c94b5d2 100644
--- a/include/gnokii/data.h
+++ b/include/gnokii/data.h
@@ -165,7 +165,7 @@ typedef void (*gn_call_notification_func_t)(gn_call_status 
call_status, gn_call_
 typedef void (*gn_rlp_rx_callback_func_t)(gn_rlp_f96_frame *frame);
 typedef void (*gn_reg_notification_func_t)(gn_network_info *info, void 
*callback_data);
 typedef void (*gn_progress_indication_func_t)(int progress, void 
*callback_data);
-typedef gn_error (*gn_auth_interactive_func_t)(struct gn_statemachine *state);
+typedef gn_error (*gn_auth_interactive_func_t)(gn_data *data, struct 
gn_statemachine *state);
 typedef struct {
        gn_on_sms_func_t on_sms;
        gn_on_cell_broadcast_func_t on_cell_broadcast;
@@ -181,6 +181,12 @@ typedef struct {
         * progress is value in range [0, 100].
         */
        gn_progress_indication_func_t progress_indication;
+       /*
+        * data->security_code->type contains the type of the security code to 
be entered.
+        * You need to put the code into data->security_code->code and return 
GN_ERR_NONE.
+        * If any other return code will be returned the authentication 
information won't be
+        * sent to the phone.
+        */
        gn_auth_interactive_func_t auth_interactive;
 } gn_callback;
 

-----------------------------------------------------------------------

Summary of changes:
 common/gsm-auth.c     |   65 +++++++++++++++++++++++++++----------------------
 common/phones/atgen.c |   15 ++++++++---
 include/gnokii/data.h |    8 +++++-
 3 files changed, 54 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]