s3-auth remove sanitized_username from auth_serversupplied_info
authorAndrew Bartlett <abartlet@samba.org>
Tue, 26 Jul 2011 03:43:33 +0000 (13:43 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 3 Aug 2011 08:48:04 +0000 (18:48 +1000)
This structure element was only written to, not read.

It is filled into the companion structure, auth_session_info()
by create_local_token().

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source3/auth/auth_util.c
source3/auth/server_info_sam.c
source3/include/auth.h
source3/include/proto.h
source3/lib/util_str.c

index e6d8e16b8ef5b64eff8bc7a40ce3ee3711bac136..b8cc871b62e8fc9917c9ba9718ee96bdd1be4f5e 100644 (file)
@@ -753,10 +753,8 @@ NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
        }
 
        result->unix_name = talloc_strdup(result, unix_username);
-       result->sanitized_username = sanitize_username(result, unix_username);
 
-       if ((result->unix_name == NULL)
-           || (result->sanitized_username == NULL)) {
+       if (result->unix_name == NULL) {
                TALLOC_FREE(result);
                return NT_STATUS_NO_MEMORY;
        }
@@ -1043,12 +1041,6 @@ static struct auth_serversupplied_info *copy_session_info_serverinfo_guest(TALLO
                return NULL;
        }
 
-       dst->sanitized_username = talloc_strdup(dst, src->unix_info->sanitized_username);
-       if (!dst->sanitized_username) {
-               TALLOC_FREE(dst);
-               return NULL;
-       }
-
        return dst;
 }
 
@@ -1413,13 +1405,6 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
 
        result->unix_name = talloc_strdup(result, found_username);
 
-       result->sanitized_username = sanitize_username(result,
-                                                      result->unix_name);
-       if (result->sanitized_username == NULL) {
-               TALLOC_FREE(result);
-               return NT_STATUS_NO_MEMORY;
-       }
-
        /* copy in the info3 */
        result->info3 = i3 = copy_netr_SamInfo3(result, info3);
        if (result->info3 == NULL) {
index 261e3de8f2d1eeb4e989a8d4e3fac9ebf711c40a..5d657f90c8103b8d125dbc25346a1ea6245c5e11 100644 (file)
@@ -92,13 +92,6 @@ NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
 
        TALLOC_FREE(pwd);
 
-       result->sanitized_username = sanitize_username(result,
-                                                      result->unix_name);
-       if (result->sanitized_username == NULL) {
-               TALLOC_FREE(result);
-               return NT_STATUS_NO_MEMORY;
-       }
-
        if (IS_DC && is_our_machine_account(username)) {
                /*
                 * This is a hack of monstrous proportions.
index 5c842fd550a0cfd5160853d21d20696d51219dec..be23adb4a72e43b33de773498a3d398c6e5f55d4 100644 (file)
@@ -66,15 +66,6 @@ struct auth_serversupplied_info {
        bool nss_token;
 
        char *unix_name;
-
-       /*
-        * For performance reasons we keep an alpha_strcpy-sanitized version
-        * of the username around as long as the global variable current_user
-        * still exists. If we did not do keep this, we'd have to call
-        * alpha_strcpy whenever we do a become_user(), potentially on every
-        * smb request. See set_current_user_info.
-        */
-       char *sanitized_username;
 };
 
 struct auth_context {
index 2619e7bbdeb044846aca9c1f71e46dc5aa81383e..47321f3aa43bd414634fb208ac9d4da0af06403b 100644 (file)
@@ -893,7 +893,6 @@ bool validate_net_name( const char *name,
                int max_len);
 char *escape_shell_string(const char *src);
 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
-char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
 
 /* The following definitions come from lib/version.c  */
 
index baa5a1f0464a9033f59d7c996877a5371dbdb311..8f4098651dca2632fc717f0347522fe3ae62f677 100644 (file)
@@ -1277,11 +1277,3 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string,
        TALLOC_FREE(s);
        return list;
 }
-
-char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username)
-{
-       fstring tmp;
-
-       alpha_strcpy(tmp, username, ". _-$", sizeof(tmp));
-       return talloc_strdup(mem_ctx, tmp);
-}