add support for authproto/username/password
authorJohn Crispin <blogic@openwrt.org>
Sun, 24 Aug 2014 19:27:31 +0000 (21:27 +0200)
committerJohn Crispin <blogic@openwrt.org>
Sun, 24 Aug 2014 19:27:31 +0000 (21:27 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
cli.c

diff --git a/cli.c b/cli.c
index 86fe7268c1cc80581dbcd3139d4bd507799c337a..d3c11d33d7008d60b1b36696b221b34bfdd7abae 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -316,7 +316,19 @@ mbim_connect_request(void)
        memcpy(c->contexttype, uuid_context_type_internet, 16);
        if (_argc > 0)
                mbim_encode_string(&c->accessstring, *_argv);
-
+       if (_argc > 3) {
+               if (!strcmp(_argv[1], "pap"))
+                       c->authprotocol = htole32(MBIM_AUTH_PROTOCOL_PAP);
+               else if (!strcmp(_argv[1], "chap"))
+                       c->authprotocol = htole32(MBIM_AUTH_PROTOCOL_CHAP);
+               else if (!strcmp(_argv[1], "mschapv2"))
+                       c->authprotocol = htole32(MBIM_AUTH_PROTOCOL_MSCHAPV2);
+               else
+                       return -1;
+
+               mbim_encode_string(&c->username, _argv[2]);
+               mbim_encode_string(&c->password, _argv[3]);
+       }
        return mbim_send_command_msg();
 }