Hi Sergei,

On 1/7/21 2:40 PM, s.e.golubt...@gmail.com wrote:
From: Sergei Golubtsov <s.e.golubt...@gmail.com>

Selection capability for authentication method via a command line
argument has been added
---
  gatchat/gsmdial.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)


<snip>

@@ -369,6 +370,17 @@ static void connect_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        }
        g_at_ppp_set_debug(ppp, gsmdial_debug, "PPP");
+ GAtPPPAuthMethod auth_method;
+
+       if (strcmp(option_auth_method, "PAP") == 0)

note that option_auth_method might be NULL and since you're using strcmp, passing NULL might result in undefined behavior.

+               auth_method = G_AT_PPP_AUTH_METHOD_PAP;
+       else if (strcmp(option_auth_method, "NONE") == 0)
+               auth_method = G_AT_PPP_AUTH_METHOD_NONE;
+       else
+               auth_method = G_AT_PPP_AUTH_METHOD_CHAP;
+
+       g_at_ppp_set_auth_method(ppp, auth_method);
+
        g_at_ppp_set_credentials(ppp, option_username, option_password);
g_at_ppp_set_acfc_enabled(ppp, option_acfc);

Note that I still get the following compiler error:

denkenz@localhost ~/ofono-master $ make
make --no-print-directory all-am
  CC       gatchat/gsmdial.o
gatchat/gsmdial.c: In function ‘connect_cb’:
gatchat/gsmdial.c:373:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  373 |  GAtPPPAuthMethod auth_method;
      |  ^~~~~~~~~~~~~~~~

oFono code must compile with gnu89 dialect of GCC, so all variable declarations must be in the appropriate block. Please make sure you compile test with optimization enabled in order for gcc to catch any errors/warnings.

I went ahead and modified the patch slightly and applied it to take care of 
this.

Regards,
-Denis
_______________________________________________
ofono mailing list -- ofono@ofono.org
To unsubscribe send an email to ofono-le...@ofono.org

Reply via email to