idmap_autorid: add idmap_autorid_saveconfigstr()
authorMichael Adam <obnox@samba.org>
Mon, 9 Sep 2013 23:45:52 +0000 (01:45 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 1 Oct 2013 22:06:32 +0000 (00:06 +0200)
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>
source3/include/idmap_autorid_tdb.h
source3/winbindd/idmap_autorid_tdb.c

index 4e9b464f6a9b6f41624b9daf9759771be509449d..88f15f2d1eee7b1e37825747773d5e11e818ced2 100644 (file)
@@ -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_ */
index 0d90cf2266f435687f637d24f1faf4603e9aa873..d66f01289d0d090cc8b0760e4b82fa18e20a6bed 100644 (file)
@@ -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;
+}