s3-pdbtest: Report and handle errors in pdb->getsampwnam()
authorAndrew Bartlett <abartlet@samba.org>
Tue, 26 Jun 2012 10:52:07 +0000 (20:52 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 26 Jun 2012 12:10:17 +0000 (14:10 +0200)
source3/torture/pdbtest.c

index 1257eff9f6e5941d862d2c7f53a774384a719b66..e2551c0010660cac5c6423f0b19bd132c03e6a36 100644 (file)
@@ -428,14 +428,16 @@ int main(int argc, char **argv)
        }
 
        /* Get account information through getsampwnam() */
-       if (NT_STATUS_IS_ERR(pdb->getsampwnam(pdb, in, out->username))) {
-               fprintf(stderr, "Error getting sampw of added user %s.\n",
-                               out->username);
+       rv = pdb->getsampwnam(pdb, in, out->username);
+       if (NT_STATUS_IS_ERR(rv)) {
+               fprintf(stderr, "Error getting sampw of added user %s: %s\n",
+                       out->username, nt_errstr(rv));
                if (!NT_STATUS_IS_OK(rv = pdb->delete_sam_account(pdb, out))) {
                        fprintf(stderr, "Error in delete_sam_account %s\n", 
                                        get_friendly_nt_error_msg(rv));
                }
                TALLOC_FREE(ctx);
+               exit(1);
        }
 
        /* Verify integrity */