summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2012-11-29 21:39:54 +0100
committerMichael Adam <obnox@samba.org>2013-01-29 12:56:11 +0100
commit65268f482d9103aff8a6e239c9b8cc53d07f760a (patch)
tree5a99ed0ed2866032890376d74055f821e406b3d6 /source3/utils
parente104e5a8192e9d9a2637035bec343de3c35ca21e (diff)
downloadsamba-65268f482d9103aff8a6e239c9b8cc53d07f760a.tar.gz
samba-65268f482d9103aff8a6e239c9b8cc53d07f760a.tar.bz2
samba-65268f482d9103aff8a6e239c9b8cc53d07f760a.zip
s3:net_idmap_dump deal with idmap config * : backend config style
this is the new config style since Samba 3.6 and should be detected by net idmap dump Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_idmap.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index ebc14e528d..6e6f205596 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -67,18 +67,25 @@ static int net_idmap_dump_one_entry(struct db_record *rec,
static const char* net_idmap_dbfile(struct net_context *c)
{
const char* dbfile = NULL;
+ const char *backend = NULL;
+
+ /* prefer idmap config * : backend over idmap backend parameter */
+ backend = lp_parm_const_string(-1, "idmap config *", "backend", NULL);
+ if (!backend) {
+ backend = lp_idmap_backend();
+ }
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")) {
+ } else if (strequal(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")) {
+ } else if (strequal(backend, "tdb2")) {
dbfile = lp_parm_talloc_string(talloc_tos(),
-1, "tdb", "idmap2.tdb", NULL);
if (dbfile == NULL) {
@@ -89,16 +96,16 @@ static const char* net_idmap_dbfile(struct net_context *c)
d_fprintf(stderr, _("Out of memory!\n"));
}
} else {
- char* backend = talloc_strdup(talloc_tos(), lp_idmap_backend());
- char* args = strchr(backend, ':');
+ char *_backend = talloc_strdup(talloc_tos(), backend);
+ char* args = strchr(_backend, ':');
if (args != NULL) {
*args = '\0';
}
d_printf(_("Sorry, 'idmap backend = %s' is currently not supported\n"),
- backend);
+ _backend);
- talloc_free(backend);
+ talloc_free(_backend);
}
return dbfile;