diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-07-14 22:06:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:19:21 -0500 |
commit | 2203228c791761bcab07961da725488636bee8df (patch) | |
tree | 2245b08d76f4d9d95f4fc97361964cc8f5a3b15d /source3/param | |
parent | 5b474afa74697321a24e952c63e60bcb1e84dced (diff) | |
download | samba-2203228c791761bcab07961da725488636bee8df.tar.gz samba-2203228c791761bcab07961da725488636bee8df.tar.bz2 samba-2203228c791761bcab07961da725488636bee8df.zip |
r17039: Eliminate snum from enumshares and getshareinfo. Get rid of some pstrings.
Volker
(This used to be commit c5e393d5eda4e13a844171d9ff319d1f1bac3d84)
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 89b07b4cda..b4b6c2bd10 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -5137,6 +5137,65 @@ BOOL share_defined(const char *service_name) return (lp_servicenumber(service_name) != -1); } +struct share_params *get_share_params(TALLOC_CTX *mem_ctx, + const char *sharename) +{ + struct share_params *result; + fstring sname; + int snum; + + fstrcpy(sname, sharename); + + snum = find_service(sname); + if (snum < 0) { + return NULL; + } + + if (!(result = TALLOC_P(mem_ctx, struct share_params))) { + DEBUG(0, ("talloc failed\n")); + return NULL; + } + + result->service = snum; + return result; +} + +struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx) +{ + struct share_iterator *result; + + if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) { + DEBUG(0, ("talloc failed\n")); + return NULL; + } + + result->next_id = 0; + return result; +} + +struct share_params *next_share(struct share_iterator *list) +{ + struct share_params *result; + + while (!lp_snum_ok(list->next_id) && + (list->next_id < lp_numservices())) { + list->next_id += 1; + } + + if (list->next_id >= lp_numservices()) { + return NULL; + } + + if (!(result = TALLOC_P(list, struct share_params))) { + DEBUG(0, ("talloc failed\n")); + return NULL; + } + + result->service = list->next_id; + list->next_id += 1; + return result; +} + /******************************************************************* A useful volume label function. ********************************************************************/ |