Merge from HEAD - make Samba compile with -Wwrite-strings without additional
[vlendec/samba-autobuild/.git] / source3 / passdb / passdb.c
index 4ce5b93abd58f2658fff9b7e95f7137a904b592d..e13f0e9dfba91b31913d4053e594ba3ea877b66f 100644 (file)
@@ -32,8 +32,6 @@
  * responsible.
  */
 
-extern pstring global_myname;
-
 /************************************************************
  Fill the SAM_ACCOUNT with default values.
  ***********************************************************/
@@ -42,6 +40,9 @@ static void pdb_fill_default_sam(SAM_ACCOUNT *user)
 {
        ZERO_STRUCT(user->private); /* Don't touch the talloc context */
 
+       /* no initial methods */
+       user->methods = NULL;
+
         /* Don't change these timestamp settings without a good reason.
            They are important for NT member server compatibility. */
 
@@ -138,7 +139,7 @@ NTSTATUS pdb_init_sam(SAM_ACCOUNT **user)
        TALLOC_CTX *mem_ctx;
        NTSTATUS nt_status;
        
-       mem_ctx = talloc_init_named("passdb internal SAM_ACCOUNT allocation");
+       mem_ctx = talloc_init("passdb internal SAM_ACCOUNT allocation");
 
        if (!mem_ctx) {
                DEBUG(0,("pdb_init_sam: error while doing talloc_init()\n"));
@@ -234,28 +235,28 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd)
                pdb_set_profile_path(sam_account, 
                                     talloc_sub_specified((sam_account)->mem_ctx, 
                                                            lp_logon_path(), 
-                                                           pwd->pw_name, global_myname, 
+                                                           pwd->pw_name, global_myname()
                                                            pwd->pw_uid, pwd->pw_gid), 
                                     PDB_DEFAULT);
                
                pdb_set_homedir(sam_account, 
                                talloc_sub_specified((sam_account)->mem_ctx, 
                                                       lp_logon_home(),
-                                                      pwd->pw_name, global_myname, 
+                                                      pwd->pw_name, global_myname()
                                                       pwd->pw_uid, pwd->pw_gid),
                                PDB_DEFAULT);
                
                pdb_set_dir_drive(sam_account, 
                                  talloc_sub_specified((sam_account)->mem_ctx, 
                                                         lp_logon_drive(),
-                                                        pwd->pw_name, global_myname, 
+                                                        pwd->pw_name, global_myname()
                                                         pwd->pw_uid, pwd->pw_gid),
                                  PDB_DEFAULT);
                
                pdb_set_logon_script(sam_account, 
                                     talloc_sub_specified((sam_account)->mem_ctx, 
                                                            lp_logon_script(),
-                                                           pwd->pw_name, global_myname, 
+                                                           pwd->pw_name, global_myname()
                                                            pwd->pw_uid, pwd->pw_gid), 
                                     PDB_DEFAULT);
                if (!pdb_set_acct_ctrl(sam_account, ACB_NORMAL, PDB_DEFAULT)) {
@@ -303,7 +304,7 @@ NTSTATUS pdb_init_sam_pw(SAM_ACCOUNT **new_sam_acct, const struct passwd *pwd)
 /**
  * Free the contets of the SAM_ACCOUNT, but not the structure.
  *
- * Also wipes the LM and NT hashes and plaintext passwrod from 
+ * Also wipes the LM and NT hashes and plaintext password from 
  * memory.
  *
  * @param user SAM_ACCOUNT to free members of.
@@ -472,7 +473,7 @@ BOOL pdb_gethexpwd(const char *p, unsigned char *pwd)
 {
        int i;
        unsigned char   lonybble, hinybble;
-       char           *hexchars = "0123456789ABCDEF";
+       const char      *hexchars = "0123456789ABCDEF";
        char           *p1, *p2;
        
        if (!p)
@@ -622,10 +623,10 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use
        DEBUG(5,("local_lookup_sid: looking up RID %u.\n", (unsigned int)rid));
        
        if (rid == DOMAIN_USER_RID_ADMIN) {
-               char **admin_list = lp_admin_users(-1);
+               const char **admin_list = lp_admin_users(-1);
                *psid_name_use = SID_NAME_USER;
                if (admin_list) {
-                       char *p = *admin_list;
+                       const char *p = *admin_list;
                        if(!next_token(&p, name, NULL, sizeof(fstring)))
                                fstrcpy(name, "Administrator");
                } else {