summaryrefslogtreecommitdiff
path: root/source3/utils/net_idmap.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-02-08 23:16:31 +0100
committerMichael Adam <obnox@samba.org>2011-02-09 14:00:34 +0100
commit92f856c51380b67ecd2e175a6ad0237d34b0eaff (patch)
treef781f5ff83a529fb2903651b6f7de6dfd241d81d /source3/utils/net_idmap.c
parente2795f566407bb97ea42a13cee1deb830e93dbb0 (diff)
downloadsamba-92f856c51380b67ecd2e175a6ad0237d34b0eaff.tar.gz
samba-92f856c51380b67ecd2e175a6ad0237d34b0eaff.tar.bz2
samba-92f856c51380b67ecd2e175a6ad0237d34b0eaff.zip
s3:net idmap: fix error reporting in net_idmap_dbfile()
The last case which results in dbfile == NULL is not an out of memory case but means no --db has been specified and the idmap backend is not supported for auto-determining the idmap tdb file.
Diffstat (limited to 'source3/utils/net_idmap.c')
-rw-r--r--source3/utils/net_idmap.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index 525ca951a9..42f1172ad2 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -61,14 +61,23 @@ static const char* net_idmap_dbfile(struct net_context *c)
if (c->opt_db != NULL) {
dbfile = talloc_strdup(talloc_tos(), c->opt_db);
+ if (dbfile == NULL) {
+ d_fprintf(stderr, _("Out of memory!\n"));
+ }
} else if (strequal(lp_idmap_backend(), "tdb")) {
dbfile = state_path("winbindd_idmap.tdb");
+ if (dbfile == NULL) {
+ d_fprintf(stderr, _("Out of memory!\n"));
+ }
} else if (strequal(lp_idmap_backend(), "tdb2")) {
dbfile = lp_parm_talloc_string(-1, "tdb", "idmap2.tdb", NULL);
if (dbfile == NULL) {
dbfile = talloc_asprintf(talloc_tos(), "%s/idmap2.tdb",
lp_private_dir());
}
+ if (dbfile == NULL) {
+ d_fprintf(stderr, _("Out of memory!\n"));
+ }
} else {
char* backend = talloc_strdup(talloc_tos(), lp_idmap_backend());
char* args = strchr(backend, ':');
@@ -81,9 +90,7 @@ static const char* net_idmap_dbfile(struct net_context *c)
talloc_free(backend);
}
- if (dbfile == NULL) {
- DEBUG(0,("Out of memory\n"));
- }
+
return dbfile;
}