]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
AUTO_USERID feature -- if the auth-user-pass option is used
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Fri, 17 Aug 2007 08:22:42 +0000 (08:22 +0000)
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Fri, 17 Aug 2007 08:22:42 +0000 (08:22 +0000)
with some argument ARG, then -ARG will be appended to the
username string that is sent to the server.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2259 e7ae566f-a301-0410-adde-c780ea21d3b5

misc.c
misc.h
ssl.c

diff --git a/misc.c b/misc.c
index a42ef24ea065a88e323372d8d5399547dc0e1610..432971178741926f70ca198c73a863ac32cafd90 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1356,7 +1356,7 @@ get_platform_prefix (void)
 }
 
 void
-get_user_pass_auto_userid (struct user_pass *up)
+get_user_pass_auto_userid (struct user_pass *up, const char *tag)
 {
   struct gc_arena gc = gc_new ();
   MD5_CTX ctx;
@@ -1381,6 +1381,8 @@ get_user_pass_auto_userid (struct user_pass *up)
     {
       buf_printf (&buf, "UNKNOWN");
     }
+  if (tag && strcmp (tag, "stdin"))
+    buf_printf (&buf, "-%s", tag);
   up->defined = true;
   gc_free (&gc);
 
diff --git a/misc.h b/misc.h
index d626dfefc9dadedc6bb20e39a03a15d9358e0750..09124e60ba329fd8fc95fd38d4fded407061e15a 100644 (file)
--- a/misc.h
+++ b/misc.h
@@ -266,7 +266,7 @@ void openvpn_sleep (const int n);
 void configure_path (void);
 
 #if AUTO_USERID
-void get_user_pass_auto_userid (struct user_pass *up);
+void get_user_pass_auto_userid (struct user_pass *up, const char *tag);
 #endif
 
 #endif
diff --git a/ssl.c b/ssl.c
index 41564ba21698bb1836b11a31056dbe5b975c2e50..85e9c6fc33717bce7dbaf771899fd465860ec034 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -298,7 +298,7 @@ auth_user_pass_setup (const char *auth_file)
   if (!auth_user_pass.defined)
     {
 #if AUTO_USERID
-      get_user_pass_auto_userid (&auth_user_pass);
+      get_user_pass_auto_userid (&auth_user_pass, auth_file);
 #else
       get_user_pass (&auth_user_pass, auth_file, UP_TYPE_AUTH, GET_USER_PASS_MANAGEMENT|GET_USER_PASS_SENSITIVE);
 #endif