Browse code

Remove AUTO_USERID feature

There is no user facing way to enable this feature and way that feature
works (username build from MAC of primary net device) is questionable.

It also does not compile anymore.
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20181008181618.8976-2-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17664.html

Signed-off-by: Gert Doering <gert@greenie.muc.de>

Arne Schwabe authored on 2018/10/09 03:16:16
Showing 5 changed files
... ...
@@ -139,7 +139,6 @@
139 139
 #define D_PACKET_TRUNC_DEBUG LOGLEV(7, 70, M_DEBUG)  /* PACKET_TRUNCATION_CHECK verbose */
140 140
 #define D_PING               LOGLEV(7, 70, M_DEBUG)  /* PING send/receive messages */
141 141
 #define D_PS_PROXY_DEBUG     LOGLEV(7, 70, M_DEBUG)  /* port share proxy debug */
142
-#define D_AUTO_USERID        LOGLEV(7, 70, M_DEBUG)  /* AUTO_USERID debugging */
143 142
 #define D_TLS_KEYSELECT      LOGLEV(7, 70, M_DEBUG)  /* show information on key selection for data channel */
144 143
 #define D_ARGV_PARSE_CMD     LOGLEV(7, 70, M_DEBUG)  /* show parse_line() errors in argv_parse_cmd */
145 144
 #define D_CRYPTO_DEBUG       LOGLEV(7, 70, M_DEBUG)  /* show detailed info from crypto.c routines */
... ...
@@ -457,51 +457,6 @@ get_auth_challenge(const char *auth_challenge, struct gc_arena *gc)
457 457
 
458 458
 #endif /* ifdef ENABLE_CLIENT_CR */
459 459
 
460
-#if AUTO_USERID
461
-
462
-void
463
-get_user_pass_auto_userid(struct user_pass *up, const char *tag)
464
-{
465
-    struct gc_arena gc = gc_new();
466
-    struct buffer buf;
467
-    uint8_t macaddr[6];
468
-    static uint8_t digest [MD5_DIGEST_LENGTH];
469
-    static const uint8_t hashprefix[] = "AUTO_USERID_DIGEST";
470
-
471
-    const md_kt_t *md5_kt = md_kt_get("MD5");
472
-    md_ctx_t *ctx;
473
-
474
-    CLEAR(*up);
475
-    buf_set_write(&buf, (uint8_t *)up->username, USER_PASS_LEN);
476
-    buf_printf(&buf, "%s", TARGET_PREFIX);
477
-    if (get_default_gateway_mac_addr(macaddr))
478
-    {
479
-        dmsg(D_AUTO_USERID, "GUPAU: macaddr=%s", format_hex_ex(macaddr, sizeof(macaddr), 0, 1, ":", &gc));
480
-        ctx = md_ctx_new();
481
-        md_ctx_init(ctx, md5_kt);
482
-        md_ctx_update(ctx, hashprefix, sizeof(hashprefix) - 1);
483
-        md_ctx_update(ctx, macaddr, sizeof(macaddr));
484
-        md_ctx_final(ctx, digest);
485
-        md_ctx_cleanup(ctx);
486
-        md_ctx_free(ctx);
487
-        buf_printf(&buf, "%s", format_hex_ex(digest, sizeof(digest), 0, 256, " ", &gc));
488
-    }
489
-    else
490
-    {
491
-        buf_printf(&buf, "UNKNOWN");
492
-    }
493
-    if (tag && strcmp(tag, "stdin"))
494
-    {
495
-        buf_printf(&buf, "-%s", tag);
496
-    }
497
-    up->defined = true;
498
-    gc_free(&gc);
499
-
500
-    dmsg(D_AUTO_USERID, "GUPAU: AUTO_USERID: '%s'", up->username);
501
-}
502
-
503
-#endif /* if AUTO_USERID */
504
-
505 460
 void
506 461
 purge_user_pass(struct user_pass *up, const bool force)
507 462
 {
... ...
@@ -159,11 +159,6 @@ void configure_path(void);
159 159
 
160 160
 const char *sanitize_control_message(const char *str, struct gc_arena *gc);
161 161
 
162
-#if AUTO_USERID
163
-void get_user_pass_auto_userid(struct user_pass *up, const char *tag);
164
-
165
-#endif
166
-
167 162
 /*
168 163
  * /sbin/ip path, may be overridden
169 164
  */
... ...
@@ -409,9 +409,6 @@ auth_user_pass_setup(const char *auth_file, const struct static_challenge_info *
409 409
     auth_user_pass_enabled = true;
410 410
     if (!auth_user_pass.defined)
411 411
     {
412
-#if AUTO_USERID
413
-        get_user_pass_auto_userid(&auth_user_pass, auth_file);
414
-#else
415 412
 #ifdef ENABLE_CLIENT_CR
416 413
         if (auth_challenge) /* dynamic challenge/response */
417 414
         {
... ...
@@ -437,7 +434,6 @@ auth_user_pass_setup(const char *auth_file, const struct static_challenge_info *
437 437
         else
438 438
 #endif /* ifdef ENABLE_CLIENT_CR */
439 439
         get_user_pass(&auth_user_pass, auth_file, UP_TYPE_AUTH, GET_USER_PASS_MANAGEMENT);
440
-#endif /* if AUTO_USERID */
441 440
     }
442 441
 }
443 442
 
... ...
@@ -659,15 +659,6 @@ socket_defined(const socket_descriptor_t sd)
659 659
 #endif
660 660
 
661 661
 /*
662
- * Do we have the capability to support the AUTO_USERID feature?
663
- */
664
-#if defined(ENABLE_AUTO_USERID)
665
-#define AUTO_USERID 1
666
-#else
667
-#define AUTO_USERID 0
668
-#endif
669
-
670
-/*
671 662
  * Do we support challenge/response authentication as client?
672 663
  */
673 664
 #if defined(ENABLE_MANAGEMENT)