Browse code

AUTO_USERID feature -- if the auth-user-pass option is used 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

james authored on 2007/08/17 17:22:42
Showing 3 changed files
... ...
@@ -1356,7 +1356,7 @@ get_platform_prefix (void)
1356 1356
 }
1357 1357
 
1358 1358
 void
1359
-get_user_pass_auto_userid (struct user_pass *up)
1359
+get_user_pass_auto_userid (struct user_pass *up, const char *tag)
1360 1360
 {
1361 1361
   struct gc_arena gc = gc_new ();
1362 1362
   MD5_CTX ctx;
... ...
@@ -1381,6 +1381,8 @@ get_user_pass_auto_userid (struct user_pass *up)
1381 1381
     {
1382 1382
       buf_printf (&buf, "UNKNOWN");
1383 1383
     }
1384
+  if (tag && strcmp (tag, "stdin"))
1385
+    buf_printf (&buf, "-%s", tag);
1384 1386
   up->defined = true;
1385 1387
   gc_free (&gc);
1386 1388
 
... ...
@@ -266,7 +266,7 @@ void openvpn_sleep (const int n);
266 266
 void configure_path (void);
267 267
 
268 268
 #if AUTO_USERID
269
-void get_user_pass_auto_userid (struct user_pass *up);
269
+void get_user_pass_auto_userid (struct user_pass *up, const char *tag);
270 270
 #endif
271 271
 
272 272
 #endif
... ...
@@ -298,7 +298,7 @@ auth_user_pass_setup (const char *auth_file)
298 298
   if (!auth_user_pass.defined)
299 299
     {
300 300
 #if AUTO_USERID
301
-      get_user_pass_auto_userid (&auth_user_pass);
301
+      get_user_pass_auto_userid (&auth_user_pass, auth_file);
302 302
 #else
303 303
       get_user_pass (&auth_user_pass, auth_file, UP_TYPE_AUTH, GET_USER_PASS_MANAGEMENT|GET_USER_PASS_SENSITIVE);
304 304
 #endif