diff options
author | Jeremy Allison <jra@samba.org> | 2000-08-21 19:30:19 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-08-21 19:30:19 +0000 |
commit | d8ad8a0d74be4e2243ded4385692e7586fe75127 (patch) | |
tree | c7c44ba1f2632b63c97a71bddaf02349af819c81 /source3 | |
parent | 7e5fd8fc2c255b5388a634b18280bb497f82e3ed (diff) | |
download | samba-d8ad8a0d74be4e2243ded4385692e7586fe75127.tar.gz samba-d8ad8a0d74be4e2243ded4385692e7586fe75127.tar.bz2 samba-d8ad8a0d74be4e2243ded4385692e7586fe75127.zip |
Fix for safe_free freeing static strings. From Robert August Vincent, II.
Jeremy.
(This used to be commit bd844fcd3023ab956eb7ab369475955a88bcca14)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/smbpasswd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 318047db20..d9fa46fe4c 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -269,12 +269,12 @@ static int process_root(int argc, char *argv[]) case 'x': local_flags |= LOCAL_DELETE_USER; user_name = optarg; - new_passwd = "XXXXXX"; + new_passwd = xstrdup("XXXXXX"); break; case 'd': local_flags |= LOCAL_DISABLE_USER; user_name = optarg; - new_passwd = "XXXXXX"; + new_passwd = xstrdup("XXXXXX"); break; case 'e': local_flags |= LOCAL_ENABLE_USER; @@ -285,7 +285,7 @@ static int process_root(int argc, char *argv[]) break; case 'n': local_flags |= LOCAL_SET_NO_PASSWORD; - new_passwd = "NO PASSWORD"; + new_passwd = xstrdup("NO PASSWORD"); break; case 'j': new_domain = optarg; @@ -344,7 +344,7 @@ static int process_root(int argc, char *argv[]) break; case 2: user_name = argv[0]; - new_passwd = argv[1]; + new_passwd = xstrdup(argv[1]); break; default: usage(); @@ -373,6 +373,7 @@ static int process_root(int argc, char *argv[]) } if (local_flags & LOCAL_ADD_USER) { + safe_free(new_passwd); new_passwd = xstrdup(user_name); strlower(new_passwd); } @@ -404,7 +405,7 @@ static int process_root(int argc, char *argv[]) if(local_flags & LOCAL_ENABLE_USER) { struct smb_passwd *smb_pass = getsmbpwnam(user_name); if((smb_pass != NULL) && (smb_pass->smb_passwd != NULL)) { - new_passwd = "XXXX"; /* Don't care. */ + new_passwd = xstrdup("XXXX"); /* Don't care. */ } } |