diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-29 12:45:46 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-29 12:45:46 +0100 |
commit | c8011b5d09390318ea6aa5639a142797128e5dab (patch) | |
tree | fb14b7ecce720dbc4fbba831a8fab045b9ac5f5c /source4/param | |
parent | bc1a369a0ed254ede591b65756d75568c45549ea (diff) | |
parent | de4a2214efb3fcc1aa04664371983dbc768eaf79 (diff) | |
download | samba-c8011b5d09390318ea6aa5639a142797128e5dab.tar.gz samba-c8011b5d09390318ea6aa5639a142797128e5dab.tar.bz2 samba-c8011b5d09390318ea6aa5639a142797128e5dab.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts:
source/scripting/python/config.mk
(This used to be commit 0ac0ea660ab63eca764149f1d2828d0238a57289)
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/generic.c | 7 | ||||
-rw-r--r-- | source4/param/loadparm.c | 128 | ||||
-rw-r--r-- | source4/param/loadparm.h | 3 | ||||
-rw-r--r-- | source4/param/param.h | 1 | ||||
-rw-r--r-- | source4/param/param.i | 7 | ||||
-rw-r--r-- | source4/param/param.py | 1 | ||||
-rw-r--r-- | source4/param/param_wrap.c | 111 | ||||
-rw-r--r-- | source4/param/share.c | 2 | ||||
-rw-r--r-- | source4/param/share_classic.c | 50 | ||||
-rw-r--r-- | source4/param/share_ldb.c | 2 | ||||
-rw-r--r-- | source4/param/tests/loadparm.c | 4 |
11 files changed, 183 insertions, 133 deletions
diff --git a/source4/param/generic.c b/source4/param/generic.c index 2327000fc9..b86e3ad234 100644 --- a/source4/param/generic.c +++ b/source4/param/generic.c @@ -259,11 +259,8 @@ int param_use(struct loadparm_context *lp_ctx, struct param_context *ctx) struct loadparm_service *service = lp_service(lp_ctx, section->name); if (service == NULL) - service = lp_add_service(lp_ctx, &sDefault, section->name); - lp_do_service_parameter(lp_ctx, - service, - param->key, - param->value); + service = lp_add_service(lp_ctx, lp_default_service(lp_ctx), section->name); + lp_do_service_parameter(lp_ctx, service, param->key, param->value); } } } diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index bad90fc74a..d94ab92ac9 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -224,44 +224,11 @@ struct loadparm_service }; -/* This is a default service used to prime a services structure */ -struct loadparm_service sDefault = { - .szService = NULL, - .szPath = NULL, - .szCopy = NULL, - .szInclude = NULL, - .szPrintername = NULL, - .szHostsallow = NULL, - .szHostsdeny = NULL, - .comment = NULL, - .volume = NULL, - .fstype = NULL, - .ntvfs_handler = NULL, - .iMaxPrintJobs = 1000, - .iMaxConnections = 0, - .iCSCPolicy = 0, - .bAvailable = true, - .bBrowseable = true, - .bRead_only = true, - .bPrint_ok = false, - .bMap_system = false, - .bMap_hidden = false, - .bMap_archive = true, - .bStrictLocking = true, - .iCreate_mask = 0744, - .iCreate_force_mode = 0000, - .iDir_mask = 0755, - .iDir_force_mode = 0000, - .copymap = NULL, - .bMSDfsRoot = false, - .bStrictSync = false, - .bCIFileSystem = false, -}; - struct loadparm_context *global_loadparm = NULL; #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct)) + /* prototypes for the special type handlers */ static bool handle_include(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr); @@ -521,11 +488,13 @@ static struct parm_struct parm_table[] = { {NULL, P_BOOL, P_NONE, 0, NULL, NULL} }; + /* local variables */ struct loadparm_context { const char *szConfigFile; struct loadparm_global *globals; struct loadparm_service **services; + struct loadparm_service *sDefault; int iNumServices; struct loadparm_service *currentService; bool bInGlobalSection; @@ -540,6 +509,10 @@ struct loadparm_context { }; +struct loadparm_service *lp_default_service(struct loadparm_context *lp_ctx) +{ + return lp_ctx->sDefault; +} /* return the parameter table @@ -619,15 +592,13 @@ static const char *lp_string(const char *s) int fn_name(struct loadparm_context *lp_ctx) {return lp_ctx->globals->var_name;} #define FN_LOCAL_STRING(fn_name,val) \ - const char *fn_name(struct loadparm_service *service) {return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault.val)));} -#define FN_LOCAL_CONST_STRING(fn_name,val) \ - const char *fn_name(struct loadparm_service *service) {return (const char *)(service != NULL && service->val != NULL) ? service->val : sDefault.val;} + const char *fn_name(struct loadparm_service *service, struct loadparm_service *sDefault) {return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val)));} #define FN_LOCAL_LIST(fn_name,val) \ - const char **fn_name(struct loadparm_service *service) {return(const char **)(service != NULL && service->val != NULL? service->val : sDefault.val);} + const char **fn_name(struct loadparm_service *service, struct loadparm_service *sDefault) {return(const char **)(service != NULL && service->val != NULL? service->val : sDefault->val);} #define FN_LOCAL_BOOL(fn_name,val) \ - bool fn_name(struct loadparm_service *service) {return((service != NULL)? service->val : sDefault.val);} + bool fn_name(struct loadparm_service *service, struct loadparm_service *sDefault) {return((service != NULL)? service->val : sDefault->val);} #define FN_LOCAL_INTEGER(fn_name,val) \ - int fn_name(struct loadparm_service *service) {return((service != NULL)? service->val : sDefault.val);} + int fn_name(struct loadparm_service *service, struct loadparm_service *sDefault) {return((service != NULL)? service->val : sDefault->val);} _PUBLIC_ FN_GLOBAL_INTEGER(lp_server_role, server_role) _PUBLIC_ FN_GLOBAL_LIST(lp_smb_ports, smb_ports) @@ -722,8 +693,11 @@ _PUBLIC_ FN_GLOBAL_INTEGER(lp_security, security) _PUBLIC_ FN_GLOBAL_BOOL(lp_paranoid_server_security, paranoid_server_security) _PUBLIC_ FN_GLOBAL_INTEGER(lp_announce_as, announce_as) _PUBLIC_ FN_GLOBAL_LIST(lp_js_include, jsInclude) -_PUBLIC_ FN_LOCAL_STRING(lp_servicename, szService) -_PUBLIC_ FN_LOCAL_CONST_STRING(lp_const_servicename, szService) +const char *lp_servicename(const struct loadparm_service *service) +{ + return lp_string((const char *)service->szService); +} + _PUBLIC_ FN_LOCAL_STRING(lp_pathname, szPath) static FN_LOCAL_STRING(_lp_printername, szPrintername) _PUBLIC_ FN_LOCAL_LIST(lp_hostsallow, szHostsallow) @@ -999,11 +973,11 @@ bool lp_parm_bool(struct loadparm_context *lp_ctx, * Initialise a service to the defaults. */ -static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx) +static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx, struct loadparm_service *sDefault) { struct loadparm_service *pservice = talloc_zero(mem_ctx, struct loadparm_service); - copy_service(pservice, &sDefault, NULL); + copy_service(pservice, sDefault, NULL); return pservice; } @@ -1085,7 +1059,7 @@ struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, lp_ctx->iNumServices++; } - lp_ctx->services[i] = init_service(lp_ctx->services); + lp_ctx->services[i] = init_service(lp_ctx->services, lp_ctx->sDefault); if (lp_ctx->services[i] == NULL) { DEBUG(0,("lp_add_service: out of memory!\n")); return NULL; @@ -1114,10 +1088,10 @@ bool lp_add_home(struct loadparm_context *lp_ctx, return false; if (!(*(default_service->szPath)) - || strequal(default_service->szPath, sDefault.szPath)) { + || strequal(default_service->szPath, lp_ctx->sDefault->szPath)) { service->szPath = talloc_strdup(service, pszHomedir); } else { - service->szPath = string_sub_talloc(service, lp_pathname(default_service),"%H", pszHomedir); + service->szPath = string_sub_talloc(service, lp_pathname(default_service, lp_ctx->sDefault), "%H", pszHomedir); } if (!(*(service->comment))) { @@ -1139,7 +1113,7 @@ bool lp_add_home(struct loadparm_context *lp_ctx, static bool lp_add_hidden(struct loadparm_context *lp_ctx, const char *name, const char *fstype) { - struct loadparm_service *service = lp_add_service(lp_ctx, &sDefault, name); + struct loadparm_service *service = lp_add_service(lp_ctx, lp_ctx->sDefault, name); if (service == NULL) return false; @@ -1243,7 +1217,7 @@ void *lp_parm_ptr(struct loadparm_context *lp_ctx, { if (service == NULL) { if (parm->class == P_LOCAL) - return ((char *)&sDefault)+parm->offset; + return ((char *)lp_ctx->sDefault)+parm->offset; else if (parm->class == P_GLOBAL) return ((char *)lp_ctx->globals)+parm->offset; else return NULL; @@ -2019,7 +1993,7 @@ static bool do_section(const char *pszSectionName, void *userdata) /* issued by the post-processing of a previous section. */ DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName)); - if ((lp_ctx->currentService = lp_add_service(lp_ctx, &sDefault, + if ((lp_ctx->currentService = lp_add_service(lp_ctx, lp_ctx->sDefault, pszSectionName)) == NULL) { DEBUG(0, ("Failed to add a new service\n")); @@ -2032,12 +2006,12 @@ static bool do_section(const char *pszSectionName, void *userdata) /** - * Determine if a partcular base parameter is currentl set to the default value. + * Determine if a particular base parameter is currently set to the default value. */ -static bool is_default(int i) +static bool is_default(struct loadparm_service *sDefault, int i) { - void *def_ptr = ((char *)&sDefault) + parm_table[i].offset; + void *def_ptr = ((char *)sDefault) + parm_table[i].offset; if (!defaults_saved) return false; switch (parm_table[i].type) { @@ -2096,12 +2070,12 @@ static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, * Display the contents of a single services record. */ -static void dump_a_service(struct loadparm_service * pService, FILE * f) +static void dump_a_service(struct loadparm_service * pService, struct loadparm_service *sDefault, FILE * f) { int i; struct param_opt *data; - if (pService != &sDefault) + if (pService != sDefault) fprintf(f, "\n[%s]\n", pService->szService); for (i = 0; parm_table[i].label; i++) @@ -2109,14 +2083,14 @@ static void dump_a_service(struct loadparm_service * pService, FILE * f) parm_table[i].offset != -1 && (*parm_table[i].label != '-') && (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset))) { - if (pService == &sDefault) { - if (defaults_saved && is_default(i)) + if (pService == sDefault) { + if (defaults_saved && is_default(sDefault, i)) continue; } else { if (equal_parameter(parm_table[i].type, ((char *)pService) + parm_table[i].offset, - ((char *)&sDefault) + + ((char *)sDefault) + parm_table[i].offset)) continue; } @@ -2189,7 +2163,7 @@ struct parm_struct *lp_next_parameter(struct loadparm_context *lp_ctx, int snum, !equal_parameter(parm_table[*i].type, ((char *)pService) + parm_table[*i].offset, - ((char *)&sDefault) + + ((char *)lp_ctx->sDefault) + parm_table[*i].offset)) { return &parm_table[(*i)++]; @@ -2266,6 +2240,18 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) talloc_set_destructor(lp_ctx, lp_destructor); lp_ctx->bInGlobalSection = true; lp_ctx->globals = talloc_zero(lp_ctx, struct loadparm_global); + lp_ctx->sDefault = talloc_zero(lp_ctx, struct loadparm_service); + + lp_ctx->sDefault->iMaxPrintJobs = 1000; + lp_ctx->sDefault->bAvailable = true; + lp_ctx->sDefault->bBrowseable = true; + lp_ctx->sDefault->bRead_only = true; + lp_ctx->sDefault->bMap_archive = true; + lp_ctx->sDefault->bStrictLocking = true; + lp_ctx->sDefault->iCreate_mask = 0744; + lp_ctx->sDefault->iCreate_force_mode = 0000; + lp_ctx->sDefault->iDir_mask = 0755; + lp_ctx->sDefault->iDir_force_mode = 0000; DEBUG(3, ("Initialising global parameters\n")); @@ -2276,7 +2262,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) !(lp_ctx->flags[i] & FLAG_CMDLINE)) { char **r; if (parm_table[i].class == P_LOCAL) { - r = (char **)(((char *)&sDefault) + parm_table[i].offset); + r = (char **)(((char *)lp_ctx->sDefault) + parm_table[i].offset); } else { r = (char **)(((char *)lp_ctx->globals) + parm_table[i].offset); } @@ -2512,21 +2498,21 @@ void lp_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults, dump_globals(lp_ctx, f, show_defaults); - dump_a_service(&sDefault, f); + dump_a_service(lp_ctx->sDefault, lp_ctx->sDefault, f); for (iService = 0; iService < maxtoprint; iService++) - lp_dump_one(f, show_defaults, lp_ctx->services[iService]); + lp_dump_one(f, show_defaults, lp_ctx->services[iService], lp_ctx->sDefault); } /** * Display the contents of one service in human-readable form. */ -void lp_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service) +void lp_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service, struct loadparm_service *sDefault) { if (service != NULL) { if (service->szService[0] == '\0') return; - dump_a_service(service, f); + dump_a_service(service, sDefault, f); } } @@ -2565,9 +2551,9 @@ struct loadparm_service *lp_service(struct loadparm_context *lp_ctx, /** * A useful volume label function. */ -const char *volume_label(struct loadparm_service *service) +const char *volume_label(struct loadparm_service *service, struct loadparm_service *sDefault) { - const char *ret = lp_volume(service); + const char *ret = lp_volume(service, sDefault); if (!*ret) return lp_servicename(service); return ret; @@ -2577,11 +2563,11 @@ const char *volume_label(struct loadparm_service *service) /** * If we are PDC then prefer us as DMB */ -const char *lp_printername(struct loadparm_service *service) +const char *lp_printername(struct loadparm_service *service, struct loadparm_service *sDefault) { - const char *ret = _lp_printername(service); + const char *ret = _lp_printername(service, sDefault); if (ret == NULL || (ret != NULL && *ret == '\0')) - ret = lp_const_servicename(service); + ret = lp_servicename(service); return ret; } @@ -2590,9 +2576,9 @@ const char *lp_printername(struct loadparm_service *service) /** * Return the max print jobs per queue. */ -int lp_maxprintjobs(struct loadparm_service *service) +int lp_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault) { - int maxjobs = (service != NULL) ? service->iMaxPrintJobs : sDefault.iMaxPrintJobs; + int maxjobs = (service != NULL) ? service->iMaxPrintJobs : sDefault->iMaxPrintJobs; if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID) maxjobs = PRINT_MAX_JOBID - 1; diff --git a/source4/param/loadparm.h b/source4/param/loadparm.h index 842e1ce437..cd3c0b9595 100644 --- a/source4/param/loadparm.h +++ b/source4/param/loadparm.h @@ -59,6 +59,9 @@ struct parm_struct { } def; }; + + + #define FLAG_DEFAULT 0x0001 /* this option was a default */ #define FLAG_CMDLINE 0x0002 /* this option was set from the command line */ diff --git a/source4/param/param.h b/source4/param/param.h index 098a73deec..84f864edaa 100644 --- a/source4/param/param.h +++ b/source4/param/param.h @@ -64,6 +64,5 @@ struct smbcli_options; #include "param/proto.h" extern struct loadparm_context *global_loadparm; -extern struct loadparm_service sDefault; #endif /* _PARAM_H */ diff --git a/source4/param/param.i b/source4/param/param.i index 7322302117..77d781d6ff 100644 --- a/source4/param/param.i +++ b/source4/param/param.i @@ -49,6 +49,7 @@ typedef struct param_opt param_opt; typedef struct loadparm_context { %extend { loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); } + struct loadparm_service *default_service() { return lp_default_service($self); } bool load(const char *filename) { return lp_load($self, filename); } bool load_default() { return lp_load_default($self); } #ifdef SWIGPYTHON @@ -167,9 +168,9 @@ typedef struct loadparm_context { typedef struct loadparm_service { %extend { - const char *volume_label() { return volume_label($self); } - const char *printername() { return lp_printername($self); } - int maxprintjobs() { return lp_maxprintjobs($self); } + const char *volume_label(struct loadparm_service *sDefault) { return volume_label($self, sDefault); } + const char *printername(struct loadparm_service *sDefault) { return lp_printername($self, sDefault); } + int maxprintjobs(struct loadparm_service *sDefault) { return lp_maxprintjobs($self, sDefault); } } } loadparm_service; diff --git a/source4/param/param.py b/source4/param/param.py index 5adf7a4ecc..025acc6be1 100644 --- a/source4/param/param.py +++ b/source4/param/param.py @@ -63,6 +63,7 @@ class LoadParm(object): def __init__(self, *args, **kwargs): _param.LoadParm_swiginit(self,_param.new_LoadParm(*args, **kwargs)) __swig_destroy__ = _param.delete_LoadParm +LoadParm.default_service = new_instancemethod(_param.LoadParm_default_service,None,LoadParm) LoadParm.load = new_instancemethod(_param.LoadParm_load,None,LoadParm) LoadParm.load_default = new_instancemethod(_param.LoadParm_load_default,None,LoadParm) LoadParm.__len__ = new_instancemethod(_param.LoadParm___len__,None,LoadParm) diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c index 275e2d67ec..e74f902645 100644 --- a/source4/param/param_wrap.c +++ b/source4/param/param_wrap.c @@ -2526,6 +2526,7 @@ typedef struct param_section param_section; typedef struct param_opt param_opt; SWIGINTERN loadparm_context *new_loadparm_context(TALLOC_CTX *mem_ctx){ return loadparm_init(mem_ctx); } +SWIGINTERN struct loadparm_service *loadparm_context_default_service(loadparm_context *self){ return lp_default_service(self); } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) @@ -2742,9 +2743,9 @@ SWIGINTERN PyObject *loadparm_context_get(loadparm_context *self,char const *par return Py_None; } SWIGINTERN void delete_loadparm_context(loadparm_context *self){ talloc_free(self); } -SWIGINTERN char const *loadparm_service_volume_label(loadparm_service *self){ return volume_label(self); } -SWIGINTERN char const *loadparm_service_printername(loadparm_service *self){ return lp_printername(self); } -SWIGINTERN int loadparm_service_maxprintjobs(loadparm_service *self){ return lp_maxprintjobs(self); } +SWIGINTERN char const *loadparm_service_volume_label(loadparm_service *self,struct loadparm_service *sDefault){ return volume_label(self, sDefault); } +SWIGINTERN char const *loadparm_service_printername(loadparm_service *self,struct loadparm_service *sDefault){ return lp_printername(self, sDefault); } +SWIGINTERN int loadparm_service_maxprintjobs(loadparm_service *self,struct loadparm_service *sDefault){ return lp_maxprintjobs(self, sDefault); } SWIGINTERN param *new_param(TALLOC_CTX *mem_ctx){ return param_init(mem_ctx); } SWIGINTERN int param_set(param *self,char const *parameter,PyObject *ob,char const *section_name){ struct param_opt *opt = param_get_add(self, parameter, section_name); @@ -2799,6 +2800,34 @@ fail: } +SWIGINTERN PyObject *_wrap_LoadParm_default_service(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { + PyObject *resultobj = 0; + loadparm_context *arg1 = (loadparm_context *) 0 ; + struct loadparm_service *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + char * kwnames[] = { + (char *) "self", NULL + }; + + arg1 = loadparm_init(NULL); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:LoadParm_default_service",kwnames,&obj0)) SWIG_fail; + if (obj0) { + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LoadParm_default_service" "', argument " "1"" of type '" "loadparm_context *""'"); + } + arg1 = (loadparm_context *)(argp1); + } + result = (struct loadparm_service *)loadparm_context_default_service(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_loadparm_service, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_LoadParm_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; loadparm_context *arg1 = (loadparm_context *) 0 ; @@ -3241,22 +3270,33 @@ SWIGINTERN PyObject *LoadParm_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN PyObject *_wrap_loadparm_service_volume_label(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_loadparm_service_volume_label(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; loadparm_service *arg1 = (loadparm_service *) 0 ; + struct loadparm_service *arg2 = (struct loadparm_service *) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject *swig_obj[1] ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "sDefault", NULL + }; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_loadparm_service, 0 | 0 ); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:loadparm_service_volume_label",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_service, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadparm_service_volume_label" "', argument " "1"" of type '" "loadparm_service *""'"); } arg1 = (loadparm_service *)(argp1); - result = (char *)loadparm_service_volume_label(arg1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_service, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "loadparm_service_volume_label" "', argument " "2"" of type '" "struct loadparm_service *""'"); + } + arg2 = (struct loadparm_service *)(argp2); + result = (char *)loadparm_service_volume_label(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: @@ -3264,22 +3304,33 @@ fail: } -SWIGINTERN PyObject *_wrap_loadparm_service_printername(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_loadparm_service_printername(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; loadparm_service *arg1 = (loadparm_service *) 0 ; + struct loadparm_service *arg2 = (struct loadparm_service *) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject *swig_obj[1] ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "sDefault", NULL + }; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_loadparm_service, 0 | 0 ); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:loadparm_service_printername",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_service, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadparm_service_printername" "', argument " "1"" of type '" "loadparm_service *""'"); } arg1 = (loadparm_service *)(argp1); - result = (char *)loadparm_service_printername(arg1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_service, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "loadparm_service_printername" "', argument " "2"" of type '" "struct loadparm_service *""'"); + } + arg2 = (struct loadparm_service *)(argp2); + result = (char *)loadparm_service_printername(arg1,arg2); resultobj = SWIG_FromCharPtr((const char *)result); return resultobj; fail: @@ -3287,22 +3338,33 @@ fail: } -SWIGINTERN PyObject *_wrap_loadparm_service_maxprintjobs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_loadparm_service_maxprintjobs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; loadparm_service *arg1 = (loadparm_service *) 0 ; + struct loadparm_service *arg2 = (struct loadparm_service *) 0 ; int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject *swig_obj[1] ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "sDefault", NULL + }; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_loadparm_service, 0 | 0 ); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:loadparm_service_maxprintjobs",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_service, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadparm_service_maxprintjobs" "', argument " "1"" of type '" "loadparm_service *""'"); } arg1 = (loadparm_service *)(argp1); - result = (int)loadparm_service_maxprintjobs(arg1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_service, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "loadparm_service_maxprintjobs" "', argument " "2"" of type '" "struct loadparm_service *""'"); + } + arg2 = (struct loadparm_service *)(argp2); + result = (int)loadparm_service_maxprintjobs(arg1,arg2); resultobj = SWIG_From_int((int)(result)); return resultobj; fail: @@ -4078,6 +4140,7 @@ SWIGINTERN PyObject *Swig_var_default_config_get(void) { static PyMethodDef SwigMethods[] = { { (char *)"new_LoadParm", (PyCFunction)_wrap_new_LoadParm, METH_NOARGS, NULL}, + { (char *)"LoadParm_default_service", (PyCFunction) _wrap_LoadParm_default_service, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"LoadParm_load", (PyCFunction) _wrap_LoadParm_load, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"LoadParm_load_default", (PyCFunction) _wrap_LoadParm_load_default, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"LoadParm___len__", (PyCFunction) _wrap_LoadParm___len__, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -4091,9 +4154,9 @@ static PyMethodDef SwigMethods[] = { { (char *)"delete_LoadParm", (PyCFunction) _wrap_delete_LoadParm, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"LoadParm_swigregister", LoadParm_swigregister, METH_VARARGS, NULL}, { (char *)"LoadParm_swiginit", LoadParm_swiginit, METH_VARARGS, NULL}, - { (char *)"loadparm_service_volume_label", (PyCFunction)_wrap_loadparm_service_volume_label, METH_O, NULL}, - { (char *)"loadparm_service_printername", (PyCFunction)_wrap_loadparm_service_printername, METH_O, NULL}, - { (char *)"loadparm_service_maxprintjobs", (PyCFunction)_wrap_loadparm_service_maxprintjobs, METH_O, NULL}, + { (char *)"loadparm_service_volume_label", (PyCFunction) _wrap_loadparm_service_volume_label, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"loadparm_service_printername", (PyCFunction) _wrap_loadparm_service_printername, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"loadparm_service_maxprintjobs", (PyCFunction) _wrap_loadparm_service_maxprintjobs, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"loadparm_service_swigregister", loadparm_service_swigregister, METH_VARARGS, NULL}, { (char *)"new_ParamFile", (PyCFunction)_wrap_new_ParamFile, METH_NOARGS, NULL}, { (char *)"ParamFile_get_section", (PyCFunction) _wrap_ParamFile_get_section, METH_VARARGS | METH_KEYWORDS, NULL}, diff --git a/source4/param/share.c b/source4/param/share.c index 2c97625bcc..bc2999b03d 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. - Modular services configuration system + Modular shares configuration system Copyright (C) Simo Sorce 2006 diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index b517c9c4c2..f5a6fa67a4 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. - Classic file based services configuration + Classic file based shares configuration Copyright (C) Simo Sorce 2006 @@ -73,25 +73,25 @@ static const char *sclassic_string_option(struct share_config *scfg, } if (strcmp(opt_name, SHARE_PATH) == 0) { - return lp_pathname(s); + return lp_pathname(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_COMMENT) == 0) { - return lp_comment(s); + return lp_comment(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_VOLUME) == 0) { - return volume_label(s); + return volume_label(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_TYPE) == 0) { - if (lp_print_ok(s)) { + if (lp_print_ok(s, lp_default_service(lp_ctx))) { return "PRINTER"; } - if (strcmp("NTFS", lp_fstype(s)) == 0) { + if (strcmp("NTFS", lp_fstype(s, lp_default_service(lp_ctx))) == 0) { return "DISK"; } - return lp_fstype(s); + return lp_fstype(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_PASSWORD) == 0) { @@ -131,27 +131,27 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, } if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) { - return lp_csc_policy(s); + return lp_csc_policy(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) { - return lp_max_connections(s); + return lp_max_connections(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_CREATE_MASK) == 0) { - return lp_create_mask(s); + return lp_create_mask(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_DIR_MASK) == 0) { - return lp_dir_mask(s); + return lp_dir_mask(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_FORCE_DIR_MODE) == 0) { - return lp_force_dir_mode(s); + return lp_force_dir_mode(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_FORCE_CREATE_MODE) == 0) { - return lp_force_create_mode(s); + return lp_force_create_mode(s, lp_default_service(lp_ctx)); } @@ -190,39 +190,39 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name } if (strcmp(opt_name, SHARE_BROWSEABLE) == 0) { - return lp_browseable(s); + return lp_browseable(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_READONLY) == 0) { - return lp_readonly(s); + return lp_readonly(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_SYSTEM) == 0) { - return lp_map_system(s); + return lp_map_system(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_HIDDEN) == 0) { - return lp_map_hidden(s); + return lp_map_hidden(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_ARCHIVE) == 0) { - return lp_map_archive(s); + return lp_map_archive(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_STRICT_LOCKING) == 0) { - return lp_strict_locking(s); + return lp_strict_locking(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) { - return lp_strict_sync(s); + return lp_strict_sync(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MSDFS_ROOT) == 0) { - return lp_msdfs_root(s); + return lp_msdfs_root(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_CI_FILESYSTEM) == 0) { - return lp_ci_filesystem(s); + return lp_ci_filesystem(s, lp_default_service(lp_ctx)); } DEBUG(0,("request for unknown share bool option '%s'\n", @@ -255,15 +255,15 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar } if (strcmp(opt_name, SHARE_HOSTS_ALLOW) == 0) { - return lp_hostsallow(s); + return lp_hostsallow(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_HOSTS_DENY) == 0) { - return lp_hostsdeny(s); + return lp_hostsdeny(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_NTVFS_HANDLER) == 0) { - return lp_ntvfs_handler(s); + return lp_ntvfs_handler(s, lp_default_service(lp_ctx)); } DEBUG(0,("request for unknown share list option '%s'\n", diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index bdea94a5cd..fb40f1e9bf 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. - LDB based services configuration + LDB based shares configuration Copyright (C) Simo Sorce 2006 diff --git a/source4/param/tests/loadparm.c b/source4/param/tests/loadparm.c index 92871e043d..49fcdf7249 100644 --- a/source4/param/tests/loadparm.c +++ b/source4/param/tests/loadparm.c @@ -129,7 +129,7 @@ static bool test_lp_parm_bytes(struct torture_context *tctx) static bool test_lp_do_service_parameter(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - struct loadparm_service *service = lp_add_service(lp_ctx, &sDefault, "foo"); + struct loadparm_service *service = lp_add_service(lp_ctx, lp_default_service(lp_ctx), "foo"); torture_assert(tctx, lp_do_service_parameter(lp_ctx, service, "some:thing", "foo"), "lp_set_option failed"); torture_assert_str_equal(tctx, lp_parm_string(lp_ctx, service, "some", "thing"), "foo", @@ -140,7 +140,7 @@ static bool test_lp_do_service_parameter(struct torture_context *tctx) static bool test_lp_service(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - struct loadparm_service *service = lp_add_service(lp_ctx, &sDefault, "foo"); + struct loadparm_service *service = lp_add_service(lp_ctx, lp_default_service(lp_ctx), "foo"); torture_assert(tctx, service == lp_service(lp_ctx, "foo"), "invalid service"); return true; } |