s3:smbd map_username() doesn't need sconn anymore
authorSimo Sorce <ssorce@redhat.com>
Mon, 31 May 2010 14:52:06 +0000 (10:52 -0400)
committerAndreas Schneider <asn@samba.org>
Mon, 31 May 2010 16:21:29 +0000 (18:21 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
source3/auth/auth_util.c
source3/include/proto.h
source3/rpc_server/srv_samr_nt.c
source3/smbd/map_username.c
source3/smbd/service.c
source3/smbd/sesssetup.c
source3/smbd/smb2_sesssetup.c

index 74d8873f5c7b060b1cb91789c087e85227f3f327..3a63a3bee35cc16acda5df9282afe21b4219405a 100644 (file)
@@ -119,13 +119,12 @@ NTSTATUS make_user_info_map(struct auth_usersupplied_info **user_info,
                            DATA_BLOB *plaintext,
                            bool encrypted)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        const char *domain;
        NTSTATUS result;
        bool was_mapped;
        fstring internal_username;
        fstrcpy(internal_username, smb_name);
-       was_mapped = map_username(sconn, internal_username);
+       was_mapped = map_username(internal_username);
 
        DEBUG(5, ("Mapping user [%s]\\[%s] from workstation [%s]\n",
                 client_domain, smb_name, wksta_name));
@@ -972,7 +971,6 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const char *domain,
                              uid_t *uid, gid_t *gid,
                              bool *username_was_mapped)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        fstring dom_user, lower_username;
        fstring real_username;
        struct passwd *passwd;
@@ -985,7 +983,7 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const char *domain,
 
        /* Get the passwd struct.  Try to create the account if necessary. */
 
-       *username_was_mapped = map_username(sconn, dom_user);
+       *username_was_mapped = map_username(dom_user);
 
        passwd = smb_getpwnam( NULL, dom_user, real_username, True );
        if (!passwd) {
index e28bfd3aaecc65061c9d19ccedcb834dd2c55409..237772e9bd1096dc361ff69b0c94346fa217fd10 100644 (file)
@@ -5689,7 +5689,7 @@ const struct mangle_fns *posix_mangle_init(void);
 
 /* The following definitions come from smbd/map_username.c  */
 
-bool map_username(struct smbd_server_connection *sconn, fstring user);
+bool map_username(fstring user);
 
 /* The following definitions come from smbd/message.c  */
 
index 5b8a79fd87da16e3a1878ff010e2d2fa9795561a..30c5c5e839a1dae3132b7f45fdfaea557e9a4c08 100644 (file)
@@ -1922,7 +1922,6 @@ NTSTATUS _samr_ChangePasswordUser(pipes_struct *p,
 NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
                                   struct samr_ChangePasswordUser2 *r)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        NTSTATUS status;
        fstring user_name;
        fstring wks;
@@ -1939,7 +1938,7 @@ NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
         * function.
         */
 
-       (void)map_username(sconn, user_name);
+       (void)map_username(user_name);
 
        /*
         * UNIX username case mangling not required, pass_oem_change
@@ -1969,7 +1968,6 @@ NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
 NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
                                      struct samr_OemChangePasswordUser2 *r)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        NTSTATUS status;
        fstring user_name;
        const char *wks = NULL;
@@ -1988,7 +1986,7 @@ NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
         * function.
         */
 
-       (void)map_username(sconn, user_name);
+       (void)map_username(user_name);
 
        /*
         * UNIX username case mangling not required, pass_oem_change
@@ -2022,7 +2020,6 @@ NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
 NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p,
                                   struct samr_ChangePasswordUser3 *r)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        NTSTATUS status;
        fstring user_name;
        const char *wks = NULL;
@@ -2045,7 +2042,7 @@ NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p,
         * function.
         */
 
-       (void)map_username(sconn, user_name);
+       (void)map_username(user_name);
 
        /*
         * UNIX username case mangling not required, pass_oem_change
index 4d2a9db307be3a4476c8571a5450002a2a976051..9b24d8fa4ed907d4cb58b3c7ddbd9b434e1a18f2 100644 (file)
@@ -118,7 +118,7 @@ static void store_map_in_gencache(const char *from, const char *to)
        TALLOC_FREE(key);
 }
 
-bool map_username(struct smbd_server_connection *sconn, fstring user)
+bool map_username(fstring user)
 {
        XFILE *f;
        char *mapfile = lp_username_map();
index afd9cad27dd96227abc5a3913d2fe619060b0590..8642544c4f065d4c24efbdab368441457d13b70a 100644 (file)
@@ -306,7 +306,6 @@ int add_home_service(const char *service, const char *username, const char *home
 int find_service(fstring service)
 {
        int iService;
-       struct smbd_server_connection *sconn = smbd_server_conn;
 
        all_string_sub(service,"\\","/",0);
 
@@ -321,7 +320,7 @@ int find_service(fstring service)
                         * Try mapping the servicename, it may
                         * be a Windows to unix mapped user name.
                         */
-                       if(map_username(sconn, service))
+                       if(map_username(service))
                                phome_dir = get_user_home_dir(
                                        talloc_tos(), service);
                }
@@ -1158,7 +1157,7 @@ connection_struct *make_connection(struct smbd_server_connection *sconn,
                                fstring unix_username;
                                fstrcpy(unix_username,
                                        current_user_info.smb_name);
-                               map_username(sconn, unix_username);
+                               map_username(unix_username);
                                snum = find_service(unix_username);
                        } 
                        if (snum != -1) {
index 7f99d6283c9898ac28f9a4a1dfdee424aa419aa9..dba6dabd267b2095c3f00b4433d350cb14db81cc 100644 (file)
@@ -413,7 +413,7 @@ static void reply_spnego_kerberos(struct smb_request *req,
 
        /* lookup the passwd struct, create a new user if necessary */
 
-       username_was_mapped = map_username(sconn, user);
+       username_was_mapped = map_username(user);
 
        pw = smb_getpwnam( mem_ctx, user, real_username, True );
 
@@ -1676,7 +1676,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
                data_blob_free(&nt_resp);
                data_blob_clear_free(&plaintext_password);
 
-               map_username(sconn, sub_user);
+               map_username(sub_user);
                add_session_user(sconn, sub_user);
                add_session_workgroup(sconn, domain);
                /* Then force it to null for the benfit of the code below */
index d91d0fe510a0891e58221acbf6f038b8248e3115..88454c122270d4ea82acb87e20b8ed53ee8d405f 100644 (file)
@@ -170,7 +170,6 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session,
        fstring tmp;
        bool username_was_mapped = false;
        bool map_domainuser_to_guest = false;
-       struct smbd_server_connection *sconn = smbd_server_conn;
 
        if (!spnego_parse_krb5_wrap(*secblob, &ticket, tok_id)) {
                status = NT_STATUS_LOGON_FAILURE;
@@ -265,7 +264,7 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session,
 
        /* lookup the passwd struct, create a new user if necessary */
 
-       username_was_mapped = map_username(sconn, user);
+       username_was_mapped = map_username(user);
 
        pw = smb_getpwnam(talloc_tos(), user, real_username, true );
        if (pw) {