summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/pdbedit.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index bdf499ae47..2ba6de55df 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -131,7 +131,9 @@ static int print_user_info (char *username, BOOL verbosity, BOOL smbpwdstyle)
SAM_ACCOUNT *sam_pwent=NULL;
BOOL ret;
- pdb_init_sam(&sam_pwent);
+ if (!NT_STATUS_IS_OK(pdb_init_sam (&sam_pwent))) {
+ return -1;
+ }
ret = pdb_getsampwnam (sam_pwent, username);
@@ -283,7 +285,9 @@ static int new_machine (char *machinename)
char name[16];
char *password = NULL;
- pdb_init_sam (&sam_pwent);
+ if (!NT_STATUS_IS_OK(pdb_init_sam (&sam_pwent))) {
+ return -1;
+ }
if (machinename[strlen (machinename) -1] == '$')
machinename[strlen (machinename) -1] = '\0';
@@ -317,9 +321,11 @@ static int new_machine (char *machinename)
static int delete_user_entry (char *username)
{
- SAM_ACCOUNT *samaccount;
+ SAM_ACCOUNT *samaccount = NULL;
- pdb_init_sam(&samaccount);
+ if (!NT_STATUS_IS_OK(pdb_init_sam (&samaccount))) {
+ return -1;
+ }
if (!pdb_getsampwnam(samaccount, username)) {
fprintf (stderr, "user %s does not exist in the passdb\n", username);
@@ -336,13 +342,15 @@ static int delete_user_entry (char *username)
static int delete_machine_entry (char *machinename)
{
char name[16];
- SAM_ACCOUNT *samaccount;
+ SAM_ACCOUNT *samaccount = NULL;
safe_strcpy (name, machinename, 16);
if (name[strlen(name)] != '$')
safe_strcat (name, "$", 16);
- pdb_init_sam(&samaccount);
+ if (!NT_STATUS_IS_OK(pdb_init_sam (&samaccount))) {
+ return -1;
+ }
if (!pdb_getsampwnam(samaccount, name)) {
fprintf (stderr, "user %s does not exist in the passdb\n", name);