]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
loadparm: Add lp_wi_scan_share_parametrics
authorVolker Lendecke <vl@samba.org>
Mon, 29 Jul 2024 14:17:21 +0000 (07:17 -0700)
committerStefan Metzmacher <metze@samba.org>
Wed, 31 Jul 2024 08:39:29 +0000 (08:39 +0000)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15688
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/param/loadparm.c
source3/param/loadparm.h

index 246e0378d652943563fc8ce33db859fc26e7abc3..f9bc1c427961468544002b730ef8a78a65931ed1 100644 (file)
@@ -1262,6 +1262,31 @@ int lp_wi_scan_global_parametrics(const char *regex_str,
        return ret;
 }
 
+int lp_wi_scan_share_parametrics(int snum,
+                                const char *regex_str,
+                                size_t max_matches,
+                                bool (*cb)(const char *string,
+                                           regmatch_t matches[],
+                                           void *private_data),
+                                void *private_data)
+{
+       struct loadparm_service *s = NULL;
+       int ret;
+
+       if (!LP_SNUM_OK(snum)) {
+               /*
+                * We return regex return values here, REG_NOMATCH is
+                * the closest I could find.
+                */
+               return REG_NOMATCH;
+       }
+       s = ServicePtrs[snum];
+
+       ret = lp_wi_scan_parametrics(
+               s->param_opt, regex_str, max_matches, cb, private_data);
+       return ret;
+}
+
 #define MISSING_PARAMETER(name) \
     DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
 
index 622e2290d3cfc93eec2e8d5e019c778f6a7e3b6d..e8f06ddbc2caba0017151e8a2705bb376016f2d6 100644 (file)
@@ -75,6 +75,13 @@ int lp_wi_scan_global_parametrics(
        bool (*cb)(const char *string, regmatch_t matches[],
                   void *private_data),
        void *private_data);
+int lp_wi_scan_share_parametrics(int snum,
+                                const char *regex_str,
+                                size_t max_matches,
+                                bool (*cb)(const char *string,
+                                           regmatch_t matches[],
+                                           void *private_data),
+                                void *private_data);
 
 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
 struct loadparm_service;