summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-09-10 01:45:52 +0200
committerMichael Adam <obnox@samba.org>2013-10-02 00:06:32 +0200
commit375168a16eedab3e60153a2b5f7cce1a22e21d5e (patch)
treea1f8095c1aa7ba0b64f9dbd1afe38aa48f0d3604 /source3
parentd560cd11e4de818ff997eea52d020e360c3ef7d0 (diff)
downloadsamba-375168a16eedab3e60153a2b5f7cce1a22e21d5e.tar.gz
samba-375168a16eedab3e60153a2b5f7cce1a22e21d5e.tar.bz2
samba-375168a16eedab3e60153a2b5f7cce1a22e21d5e.zip
idmap_autorid: add idmap_autorid_saveconfigstr()
Store a configuration as provided by a config string after parsing and validating the string. Based on similar patch by Atul Kulkarni <atul.kulkarni@in.ibm.com>. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/include/idmap_autorid_tdb.h9
-rw-r--r--source3/winbindd/idmap_autorid_tdb.c16
2 files changed, 25 insertions, 0 deletions
diff --git a/source3/include/idmap_autorid_tdb.h b/source3/include/idmap_autorid_tdb.h
index 4e9b464f6a..88f15f2d1e 100644
--- a/source3/include/idmap_autorid_tdb.h
+++ b/source3/include/idmap_autorid_tdb.h
@@ -127,4 +127,13 @@ NTSTATUS idmap_autorid_getconfigstr(struct db_context *db, TALLOC_CTX *mem_ctx,
bool idmap_autorid_parse_configstr(const char *configstr,
struct autorid_global_config *cfg);
+
+/**
+ * Save the global autorid configuration into the autorid database
+ * as provided in the config string.
+ * First parse the configstr and validate it.
+ */
+NTSTATUS idmap_autorid_saveconfigstr(struct db_context *db,
+ const char *configstr);
+
#endif /* _IDMAP_AUTORID_H_ */
diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c
index 0d90cf2266..d66f01289d 100644
--- a/source3/winbindd/idmap_autorid_tdb.c
+++ b/source3/winbindd/idmap_autorid_tdb.c
@@ -601,3 +601,19 @@ done:
TALLOC_FREE(frame);
return status;
}
+
+NTSTATUS idmap_autorid_saveconfigstr(struct db_context *db,
+ const char *configstr)
+{
+ bool ok;
+ NTSTATUS status;
+ struct autorid_global_config cfg;
+
+ ok = idmap_autorid_parse_configstr(configstr, &cfg);
+ if (!ok) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ status = idmap_autorid_saveconfig(db, &cfg);
+ return status;
+}