summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-29 09:43:17 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-29 09:43:17 +0000
commit281d95e2f35f8276d23d075d6e528d16eda9fadc (patch)
tree9b91d5842a743bf3135e91a3942b76a173e1fd13 /source3/utils
parente3ae1a2f2398e8fa107673e83f75675629938d75 (diff)
downloadsamba-281d95e2f35f8276d23d075d6e528d16eda9fadc.tar.gz
samba-281d95e2f35f8276d23d075d6e528d16eda9fadc.tar.bz2
samba-281d95e2f35f8276d23d075d6e528d16eda9fadc.zip
Use a common function to create the SAM_ACCOUNT being used to add accounts
to the system. This means that we always run Get_Pwnam(), and can never add FOO when foo exists on the system (the idea is to instead add foo into the passdb, using it's full name, RID etc). Andrew Bartlett (This used to be commit bb79b127e02cefae13c822fd0fd165f1f214b740)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/pdbedit.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index d7de709e21..3a3d06a645 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -351,20 +351,12 @@ static int new_user (struct pdb_context *in, const char *username,
const char *profile, char *user_sid, char *group_sid)
{
SAM_ACCOUNT *sam_pwent=NULL;
- struct passwd *pwd = NULL;
+ NTSTATUS nt_status;
char *password1, *password2, *staticpass;
- ZERO_STRUCT(sam_pwent);
-
- if ((pwd = getpwnam_alloc(username))) {
- pdb_init_sam_pw (&sam_pwent, pwd);
- passwd_free(&pwd);
- } else {
- fprintf (stderr, "WARNING: user %s does not exist in system passwd\n", username);
- pdb_init_sam(&sam_pwent);
- if (!pdb_set_username(sam_pwent, username, PDB_CHANGED)) {
- return -1;
- }
+ if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam_new(&sam_pwent, username))) {
+ DEBUG(0, ("could not create account to add new user %s\n", username));
+ return -1;
}
staticpass = getpass("new password:");