From c10e0dee343ba9c4d036f36f40a383db115b7e02 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Sun, 10 Feb 2008 13:01:20 +0100 Subject: loadparm: Clean up trailing whitespace No code change. Couldn't resist. (This used to be commit abc816b3884838441ab379c9e31e16937caa4734) --- source4/param/loadparm.c | 326 +++++++++++++++++++++++------------------------ 1 file changed, 163 insertions(+), 163 deletions(-) (limited to 'source4') diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 9ec5a59d15..e850d82193 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -11,17 +11,17 @@ Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. Copyright (C) James Myers 2003 Copyright (C) Jelmer Vernooij 2007 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -40,7 +40,7 @@ * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING()) * 4) If it's a global then initialise it in init_globals. If a local * (ie. service) parameter then initialise it in the sDefault structure - * + * * * Notes: * The configuration file is processed sequentially for speed. It is NOT @@ -150,7 +150,7 @@ struct loadparm_global char *socket_options; int bWINSsupport; int bWINSdnsProxy; - char *szWINSHook; + char *szWINSHook; int bLocalMaster; int bPreferredMaster; int bEncryptPasswords; @@ -182,7 +182,7 @@ struct loadparm_global /** - * This structure describes a single service. + * This structure describes a single service. */ struct loadparm_service { @@ -228,28 +228,28 @@ struct loadparm_service sDefault = { .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, + .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, + .iDir_mask = 0755, + .iDir_force_mode = 0000, .copymap = NULL, .bMSDfsRoot = false, .bStrictSync = false, @@ -261,9 +261,9 @@ 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, +static bool handle_include(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr); -static bool handle_copy(struct loadparm_context *lp_ctx, +static bool handle_copy(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr); static bool handle_debuglevel(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr); @@ -308,9 +308,9 @@ static const struct enum_list enum_bool_auto[] = { }; /* Client-side offline caching policy types */ -enum csc_policy { - CSC_POLICY_MANUAL=0, - CSC_POLICY_DOCUMENTS=1, +enum csc_policy { + CSC_POLICY_MANUAL=0, + CSC_POLICY_DOCUMENTS=1, CSC_POLICY_PROGRAMS=2, CSC_POLICY_DISABLE=3 }; @@ -397,12 +397,12 @@ static struct parm_struct parm_table[] = { {"client lanman auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bClientLanManAuth), NULL, NULL}, {"client plaintext auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bClientPlaintextAuth), NULL, NULL}, {"client use spnego principal", P_BOOL, P_GLOBAL, GLOBAL_VAR(client_use_spnego_principal), NULL, NULL}, - + {"read only", P_BOOL, P_LOCAL, LOCAL_VAR(bRead_only), NULL, NULL}, - {"create mask", P_OCTAL, P_LOCAL, LOCAL_VAR(iCreate_mask), NULL, NULL}, + {"create mask", P_OCTAL, P_LOCAL, LOCAL_VAR(iCreate_mask), NULL, NULL}, {"force create mode", P_OCTAL, P_LOCAL, LOCAL_VAR(iCreate_force_mode), NULL, NULL}, - {"directory mask", P_OCTAL, P_LOCAL, LOCAL_VAR(iDir_mask), NULL, NULL}, + {"directory mask", P_OCTAL, P_LOCAL, LOCAL_VAR(iDir_mask), NULL, NULL}, {"force directory mode", P_OCTAL, P_LOCAL, LOCAL_VAR(iDir_force_mode), NULL, NULL}, {"hosts allow", P_LIST, P_LOCAL, LOCAL_VAR(szHostsallow), NULL, NULL}, @@ -411,7 +411,7 @@ static struct parm_struct parm_table[] = { {"log level", P_INTEGER, P_GLOBAL, GLOBAL_VAR(debuglevel), handle_debuglevel, NULL}, {"debuglevel", P_INTEGER, P_GLOBAL, GLOBAL_VAR(debuglevel), handle_debuglevel, NULL}, {"log file", P_STRING, P_GLOBAL, GLOBAL_VAR(logfile), handle_logfile, NULL}, - + {"smb ports", P_LIST, P_GLOBAL, GLOBAL_VAR(smb_ports), NULL, NULL}, {"nbt port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(nbt_port), NULL, NULL}, {"dgram port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(dgram_port), NULL, NULL}, @@ -435,7 +435,7 @@ static struct parm_struct parm_table[] = { {"read raw", P_BOOL, P_GLOBAL, GLOBAL_VAR(bReadRaw), NULL, NULL}, {"write raw", P_BOOL, P_GLOBAL, GLOBAL_VAR(bWriteRaw), NULL, NULL}, {"disable netbios", P_BOOL, P_GLOBAL, GLOBAL_VAR(bDisableNetbios), NULL, NULL}, - + {"nt status support", P_BOOL, P_GLOBAL, GLOBAL_VAR(bNTStatusSupport), NULL, NULL}, {"announce version", P_STRING, P_GLOBAL, GLOBAL_VAR(szAnnounceVersion), NULL, NULL}, @@ -457,13 +457,13 @@ static struct parm_struct parm_table[] = { {"paranoid server security", P_BOOL, P_GLOBAL, GLOBAL_VAR(paranoid_server_security), NULL, NULL}, {"socket options", P_STRING, P_GLOBAL, GLOBAL_VAR(socket_options), NULL, NULL}, - {"strict sync", P_BOOL, P_LOCAL, LOCAL_VAR(bStrictSync), NULL, NULL}, + {"strict sync", P_BOOL, P_LOCAL, LOCAL_VAR(bStrictSync), NULL, NULL}, {"case insensitive filesystem", P_BOOL, P_LOCAL, LOCAL_VAR(bCIFileSystem), NULL, NULL}, {"max print jobs", P_INTEGER, P_LOCAL, LOCAL_VAR(iMaxPrintJobs), NULL, NULL}, {"printable", P_BOOL, P_LOCAL, LOCAL_VAR(bPrint_ok), NULL, NULL}, {"print ok", P_BOOL, P_LOCAL, LOCAL_VAR(bPrint_ok), NULL, NULL}, - + {"printer name", P_STRING, P_LOCAL, LOCAL_VAR(szPrintername), NULL, NULL}, {"printer", P_STRING, P_LOCAL, LOCAL_VAR(szPrintername), NULL, NULL}, @@ -483,7 +483,7 @@ static struct parm_struct parm_table[] = { {"wins hook", P_STRING, P_GLOBAL, GLOBAL_VAR(szWINSHook), NULL, NULL}, {"csc policy", P_ENUM, P_LOCAL, LOCAL_VAR(iCSCPolicy), NULL, enum_csc_policy}, - + {"strict locking", P_BOOL, P_LOCAL, LOCAL_VAR(bStrictLocking), NULL, NULL}, {"share backend", P_STRING, P_GLOBAL, GLOBAL_VAR(szShareBackend), NULL, NULL}, @@ -495,11 +495,11 @@ static struct parm_struct parm_table[] = { {"pid directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szPidDir), NULL, NULL}, {"js include", P_LIST, P_GLOBAL, GLOBAL_VAR(jsInclude), NULL, NULL}, {"setup directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szSetupDir), NULL, NULL}, - + {"socket address", P_STRING, P_GLOBAL, GLOBAL_VAR(szSocketAddress), NULL, NULL}, {"copy", P_STRING, P_LOCAL, LOCAL_VAR(szCopy), handle_copy, NULL}, {"include", P_STRING, P_LOCAL, LOCAL_VAR(szInclude), handle_include, NULL}, - + {"available", P_BOOL, P_LOCAL, LOCAL_VAR(bAvailable), NULL, NULL}, {"volume", P_STRING, P_LOCAL, LOCAL_VAR(volume), NULL, NULL }, {"fstype", P_STRING, P_LOCAL, LOCAL_VAR(fstype), NULL, NULL}, @@ -547,7 +547,7 @@ struct parm_struct *lp_parm_table(void) /** * Convenience routine to grab string parameters into temporary memory - * and run standard_sub_basic on them. + * and run standard_sub_basic on them. * * The buffers can be written to by * callers without affecting the source string. @@ -595,8 +595,8 @@ static const char *lp_string(const char *s) } /* - In this section all the functions that are used to access the - parameters from the rest of the program are defined + In this section all the functions that are used to access the + parameters from the rest of the program are defined */ #define FN_GLOBAL_STRING(fn_name,var_name) \ @@ -750,7 +750,7 @@ static int map_parameter(const char *pszParmName); static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx, const char *pszServiceName); static void copy_service(struct loadparm_service *pserviceDest, - struct loadparm_service *pserviceSource, + struct loadparm_service *pserviceSource, int *pcopymapDest); static bool service_ok(struct loadparm_service *service); static bool do_section(const char *pszSectionName, void *); @@ -759,8 +759,8 @@ static void init_copymap(struct loadparm_service *pservice); /* This is a helper function for parametrical options support. */ /* It returns a pointer to parametrical option value if it exists or NULL otherwise */ /* Actual parametrical functions are quite simple */ -const char *lp_get_parametric(struct loadparm_context *lp_ctx, - struct loadparm_service *service, +const char *lp_get_parametric(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option) { char *vfskey; @@ -768,9 +768,9 @@ const char *lp_get_parametric(struct loadparm_context *lp_ctx, if (lp_ctx == NULL) return NULL; - + data = (service == NULL ? lp_ctx->globals->param_opt : service->param_opt); - + asprintf(&vfskey, "%s:%s", type, option); strlower(vfskey); @@ -785,7 +785,7 @@ const char *lp_get_parametric(struct loadparm_context *lp_ctx, if (service != NULL) { /* Try to fetch the same option but from globals */ /* but only if we are not already working with globals */ - for (data = lp_ctx->globals->param_opt; data; + for (data = lp_ctx->globals->param_opt; data; data = data->next) { if (strcmp(data->key, vfskey) == 0) { free(vfskey); @@ -795,7 +795,7 @@ const char *lp_get_parametric(struct loadparm_context *lp_ctx, } free(vfskey); - + return NULL; } @@ -811,7 +811,7 @@ static int lp_int(const char *s) return -1; } - return strtol(s, NULL, 0); + return strtol(s, NULL, 0); } /** @@ -853,7 +853,7 @@ static bool lp_bool(const char *s) DEBUG(0,("lp_bool(%s): is called with NULL!\n",s)); return false; } - + if (!set_boolean(s, &ret)) { DEBUG(0,("lp_bool(%s): value is not boolean!\n",s)); return false; @@ -866,11 +866,11 @@ static bool lp_bool(const char *s) /** * Return parametric option from a given service. Type is a part of option before ':' * Parametric option has following syntax: 'Type: option = value' - * Returned value is allocated in 'lp_talloc' context + * Returned value is allocated in 'lp_talloc' context */ -const char *lp_parm_string(struct loadparm_context *lp_ctx, - struct loadparm_service *service, const char *type, +const char *lp_parm_string(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option) { const char *value = lp_get_parametric(lp_ctx, service, type, option); @@ -888,13 +888,13 @@ const char *lp_parm_string(struct loadparm_context *lp_ctx, */ const char **lp_parm_string_list(TALLOC_CTX *mem_ctx, - struct loadparm_context *lp_ctx, - struct loadparm_service *service, - const char *type, + struct loadparm_context *lp_ctx, + struct loadparm_service *service, + const char *type, const char *option, const char *separator) { const char *value = lp_get_parametric(lp_ctx, service, type, option); - + if (value != NULL) return str_list_make(mem_ctx, value, separator); @@ -906,12 +906,12 @@ const char **lp_parm_string_list(TALLOC_CTX *mem_ctx, * Parametric option has following syntax: 'Type: option = value' */ -int lp_parm_int(struct loadparm_context *lp_ctx, - struct loadparm_service *service, const char *type, +int lp_parm_int(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option, int default_v) { const char *value = lp_get_parametric(lp_ctx, service, type, option); - + if (value) return lp_int(value); @@ -924,8 +924,8 @@ int lp_parm_int(struct loadparm_context *lp_ctx, * Parametric option has following syntax: 'Type: option = value'. */ -int lp_parm_bytes(struct loadparm_context *lp_ctx, - struct loadparm_service *service, const char *type, +int lp_parm_bytes(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option, int default_v) { uint64_t bval; @@ -942,16 +942,16 @@ int lp_parm_bytes(struct loadparm_context *lp_ctx, } /** - * Return parametric option from a given service. + * Return parametric option from a given service. * Type is a part of option before ':' * Parametric option has following syntax: 'Type: option = value' */ -unsigned long lp_parm_ulong(struct loadparm_context *lp_ctx, - struct loadparm_service *service, const char *type, +unsigned long lp_parm_ulong(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option, unsigned long default_v) { const char *value = lp_get_parametric(lp_ctx, service, type, option); - + if (value) return lp_ulong(value); @@ -959,12 +959,12 @@ unsigned long lp_parm_ulong(struct loadparm_context *lp_ctx, } -double lp_parm_double(struct loadparm_context *lp_ctx, - struct loadparm_service *service, const char *type, +double lp_parm_double(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option, double default_v) { const char *value = lp_get_parametric(lp_ctx, service, type, option); - + if (value != NULL) return lp_double(value); @@ -976,12 +976,12 @@ double lp_parm_double(struct loadparm_context *lp_ctx, * Parametric option has following syntax: 'Type: option = value' */ -bool lp_parm_bool(struct loadparm_context *lp_ctx, - struct loadparm_service *service, const char *type, +bool lp_parm_bool(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *type, const char *option, bool default_v) { const char *value = lp_get_parametric(lp_ctx, service, type, option); - + if (value != NULL) return lp_bool(value); @@ -995,7 +995,7 @@ bool lp_parm_bool(struct loadparm_context *lp_ctx, static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx) { - struct loadparm_service *pservice = + struct loadparm_service *pservice = talloc_zero(mem_ctx, struct loadparm_service); copy_service(pservice, &sDefault, NULL); return pservice; @@ -1009,7 +1009,7 @@ static bool string_set(TALLOC_CTX *mem_ctx, char **dest, const char *src) { talloc_free(*dest); - if (src == NULL) + if (src == NULL) src = ""; *dest = talloc_strdup(mem_ctx, src); @@ -1024,12 +1024,12 @@ static bool string_set(TALLOC_CTX *mem_ctx, char **dest, const char *src) /** - * Add a new service to the services array initialising it with the given - * service. + * Add a new service to the services array initialising it with the given + * service. */ -struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, - const struct loadparm_service *pservice, +struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, + const struct loadparm_service *pservice, const char *name) { int i; @@ -1041,7 +1041,7 @@ struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, /* it might already exist */ if (name) { - struct loadparm_service *service = getservicebyname(lp_ctx, + struct loadparm_service *service = getservicebyname(lp_ctx, name); if (service != NULL) { /* Clean all parametric options for service */ @@ -1065,9 +1065,9 @@ struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, /* if not, then create one */ if (i == lp_ctx->iNumServices) { struct loadparm_service **tsp; - + tsp = talloc_realloc(lp_ctx, lp_ctx->services, struct loadparm_service *, num_to_alloc); - + if (!tsp) { DEBUG(0,("lp_add_service: failed to enlarge services!\n")); return NULL; @@ -1077,7 +1077,7 @@ struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, } lp_ctx->iNumServices++; - } + } lp_ctx->services[i] = init_service(lp_ctx->services); if (lp_ctx->services[i] == NULL) { @@ -1091,12 +1091,12 @@ struct loadparm_service *lp_add_service(struct loadparm_context *lp_ctx, } /** - * Add a new home service, with the specified home directory, defaults coming + * Add a new home service, with the specified home directory, defaults coming * from service ifrom. */ -bool lp_add_home(struct loadparm_context *lp_ctx, - const char *pszHomename, +bool lp_add_home(struct loadparm_context *lp_ctx, + const char *pszHomename, struct loadparm_service *default_service, const char *user, const char *pszHomedir) { @@ -1120,9 +1120,9 @@ bool lp_add_home(struct loadparm_context *lp_ctx, service->bAvailable = default_service->bAvailable; service->bBrowseable = default_service->bBrowseable; - DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", + DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename, user, service->szPath)); - + return true; } @@ -1130,7 +1130,7 @@ bool lp_add_home(struct loadparm_context *lp_ctx, * Add the IPC service. */ -static bool lp_add_hidden(struct loadparm_context *lp_ctx, const char *name, +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); @@ -1140,7 +1140,7 @@ static bool lp_add_hidden(struct loadparm_context *lp_ctx, const char *name, string_set(service, &service->szPath, tmpdir()); - service->comment = talloc_asprintf(service, "%s Service (%s)", + service->comment = talloc_asprintf(service, "%s Service (%s)", fstype, lp_ctx->globals->szServerString); string_set(service, &service->fstype, fstype); service->iMaxConnections = -1; @@ -1150,7 +1150,7 @@ static bool lp_add_hidden(struct loadparm_context *lp_ctx, const char *name, service->bBrowseable = false; if (strcasecmp(fstype, "IPC") == 0) { - lp_do_service_parameter(lp_ctx, service, "ntvfs handler", + lp_do_service_parameter(lp_ctx, service, "ntvfs handler", "default"); } @@ -1164,7 +1164,7 @@ static bool lp_add_hidden(struct loadparm_context *lp_ctx, const char *name, */ bool lp_add_printer(struct loadparm_context *lp_ctx, - const char *pszPrintername, + const char *pszPrintername, struct loadparm_service *default_service) { const char *comment = "From Printcap"; @@ -1194,7 +1194,7 @@ bool lp_add_printer(struct loadparm_context *lp_ctx, } /** - * Map a parameter's string representation to something we can use. + * Map a parameter's string representation to something we can use. * Returns False if the parameter string is not recognised, else TRUE. */ @@ -1269,8 +1269,8 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx * If pcopymapDest is NULL then copy all fields */ -static void copy_service(struct loadparm_service *pserviceDest, - struct loadparm_service *pserviceSource, +static void copy_service(struct loadparm_service *pserviceDest, + struct loadparm_service *pserviceSource, int *pcopymapDest) { int i; @@ -1298,13 +1298,13 @@ static void copy_service(struct loadparm_service *pserviceDest, break; case P_STRING: - string_set(pserviceDest, + string_set(pserviceDest, (char **)dest_ptr, *(char **)src_ptr); break; case P_USTRING: - string_set(pserviceDest, + string_set(pserviceDest, (char **)dest_ptr, *(char **)src_ptr); strupper(*(char **)dest_ptr); @@ -1325,7 +1325,7 @@ static void copy_service(struct loadparm_service *pserviceDest, (void *)pserviceSource->copymap, sizeof(int) * NUMPARAMETERS); } - + data = pserviceSource->param_opt; while (data) { not_added = true; @@ -1335,7 +1335,7 @@ static void copy_service(struct loadparm_service *pserviceDest, /* If we already have same option, override it */ if (strcmp(pdata->key, data->key) == 0) { talloc_free(pdata->value); - pdata->value = talloc_reference(pdata, + pdata->value = talloc_reference(pdata, data->value); not_added = false; break; @@ -1392,11 +1392,11 @@ static bool service_ok(struct loadparm_service *service) /******************************************************************* - Keep a linked list of all config files so we know when one has changed + Keep a linked list of all config files so we know when one has changed it's date and needs to be reloaded. ********************************************************************/ -static void add_to_file_list(struct loadparm_context *lp_ctx, +static void add_to_file_list(struct loadparm_context *lp_ctx, const char *fname, const char *subfname) { struct file_lists *f = lp_ctx->file_lists; @@ -1466,7 +1466,7 @@ bool lp_file_list_changed(struct loadparm_context *lp_ctx) Handle the include operation. ***************************************************************************/ -static bool handle_include(struct loadparm_context *lp_ctx, +static bool handle_include(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr) { char *fname = standard_sub_basic(lp_ctx, pszParmValue); @@ -1487,7 +1487,7 @@ static bool handle_include(struct loadparm_context *lp_ctx, Handle the interpretation of the copy parameter. ***************************************************************************/ -static bool handle_copy(struct loadparm_context *lp_ctx, +static bool handle_copy(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr) { bool bRetval; @@ -1509,7 +1509,7 @@ static bool handle_copy(struct loadparm_context *lp_ctx, bRetval = true; } } else { - DEBUG(0, ("Unable to copy service - source not found: %s\n", + DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue)); bRetval = false; } @@ -1517,7 +1517,7 @@ static bool handle_copy(struct loadparm_context *lp_ctx, return bRetval; } -static bool handle_debuglevel(struct loadparm_context *lp_ctx, +static bool handle_debuglevel(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr) { DEBUGLEVEL = atoi(pszParmValue); @@ -1525,7 +1525,7 @@ static bool handle_debuglevel(struct loadparm_context *lp_ctx, return true; } -static bool handle_logfile(struct loadparm_context *lp_ctx, +static bool handle_logfile(struct loadparm_context *lp_ctx, const char *pszParmValue, char **ptr) { logfile = pszParmValue; @@ -1554,9 +1554,9 @@ static void init_copymap(struct loadparm_service *pservice) /** * Process a parametric option */ -static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx, - struct loadparm_service *service, - const char *pszParmName, +static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx, + struct loadparm_service *service, + const char *pszParmName, const char *pszParmValue, int flags) { struct param_opt *paramo, *data; @@ -1611,18 +1611,18 @@ static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx, } free(name); - + return true; } -static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr, +static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr, const char *pszParmName, const char *pszParmValue, struct loadparm_context *lp_ctx) { int i; /* if it is a special case then go ahead */ if (parm_table[parmnum].special) { - parm_table[parmnum].special(lp_ctx, pszParmValue, + parm_table[parmnum].special(lp_ctx, pszParmValue, (char **)parm_ptr); return true; } @@ -1664,7 +1664,7 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr, } case P_LIST: - *(const char ***)parm_ptr = str_list_make(mem_ctx, + *(const char ***)parm_ptr = str_list_make(mem_ctx, pszParmValue, NULL); break; @@ -1710,7 +1710,7 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr, } -bool lp_do_global_parameter(struct loadparm_context *lp_ctx, +bool lp_do_global_parameter(struct loadparm_context *lp_ctx, const char *pszParmName, const char *pszParmValue) { int parmnum = map_parameter(pszParmName); @@ -1732,12 +1732,12 @@ bool lp_do_global_parameter(struct loadparm_context *lp_ctx, parm_ptr = lp_parm_ptr(lp_ctx, NULL, &parm_table[parmnum]); - return set_variable(lp_ctx, parmnum, parm_ptr, + return set_variable(lp_ctx, parmnum, parm_ptr, pszParmName, pszParmValue, lp_ctx); } -bool lp_do_service_parameter(struct loadparm_context *lp_ctx, - struct loadparm_service *service, +bool lp_do_service_parameter(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *pszParmName, const char *pszParmValue) { void *parm_ptr; @@ -1769,14 +1769,14 @@ bool lp_do_service_parameter(struct loadparm_context *lp_ctx, if (!service->copymap) init_copymap(service); - /* this handles the aliases - set the copymap for other + /* this handles the aliases - set the copymap for other * entries with the same data pointer */ for (i = 0; parm_table[i].label; i++) - if (parm_table[i].offset == parm_table[parmnum].offset && + if (parm_table[i].offset == parm_table[parmnum].offset && parm_table[i].class == parm_table[parmnum].class) service->copymap[i] = false; - return set_variable(service, parmnum, parm_ptr, pszParmName, + return set_variable(service, parmnum, parm_ptr, pszParmName, pszParmValue, lp_ctx); } @@ -1784,15 +1784,15 @@ bool lp_do_service_parameter(struct loadparm_context *lp_ctx, * Process a parameter. */ -static bool do_parameter(const char *pszParmName, const char *pszParmValue, +static bool do_parameter(const char *pszParmName, const char *pszParmValue, void *userdata) { struct loadparm_context *lp_ctx = (struct loadparm_context *)userdata; - if (lp_ctx->bInGlobalSection) - return lp_do_global_parameter(lp_ctx, pszParmName, + if (lp_ctx->bInGlobalSection) + return lp_do_global_parameter(lp_ctx, pszParmName, pszParmValue); - else + else return lp_do_service_parameter(lp_ctx, lp_ctx->currentService, pszParmName, pszParmValue); } @@ -1801,14 +1801,14 @@ static bool do_parameter(const char *pszParmName, const char *pszParmValue, variable argument do parameter */ bool lp_do_global_parameter_var(struct loadparm_context *lp_ctx, const char *pszParmName, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4); -bool lp_do_global_parameter_var(struct loadparm_context *lp_ctx, - const char *pszParmName, const char *fmt, ...) +bool lp_do_global_parameter_var(struct loadparm_context *lp_ctx, + const char *pszParmName, const char *fmt, ...) { char *s; bool ret; va_list ap; - va_start(ap, fmt); + va_start(ap, fmt); s = talloc_vasprintf(NULL, fmt, ap); va_end(ap); ret = lp_do_global_parameter(lp_ctx, pszParmName, s); @@ -1822,7 +1822,7 @@ bool lp_do_global_parameter_var(struct loadparm_context *lp_ctx, parsing code. It sets the parameter then marks the parameter as unable to be modified by smb.conf processing */ -bool lp_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName, +bool lp_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName, const char *pszParmValue) { int parmnum = map_parameter(pszParmName); @@ -1833,7 +1833,7 @@ bool lp_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName, if (parmnum < 0 && strchr(pszParmName, ':')) { /* set a parametric option */ - return lp_do_parameter_parametric(lp_ctx, NULL, pszParmName, + return lp_do_parameter_parametric(lp_ctx, NULL, pszParmName, pszParmValue, FLAG_CMDLINE); } @@ -1926,7 +1926,7 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) case P_LIST: if ((char ***)ptr && *(char ***)ptr) { char **list = *(char ***)ptr; - + for (; *list; list++) fprintf(f, "%s%s", *list, ((*(list+1))?", ":"")); @@ -1959,7 +1959,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2) return (*((int *)ptr1) == *((int *)ptr2)); case P_LIST: - return str_list_equal((const char **)(*(char ***)ptr1), + return str_list_equal((const char **)(*(char ***)ptr1), (const char **)(*(char ***)ptr2)); case P_STRING: @@ -1977,11 +1977,11 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2) } /** - * Process a new section (service). + * Process a new section (service). * * At this stage all sections are services. * Later we'll have special sections that permit server parameters to be set. - * Returns True on success, False on failure. + * Returns True on success, False on failure. */ static bool do_section(const char *pszSectionName, void *userdata) @@ -2013,7 +2013,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, &sDefault, pszSectionName)) == NULL) { DEBUG(0, ("Failed to add a new service\n")); @@ -2059,12 +2059,12 @@ static bool is_default(int i) *Display the contents of the global structure. */ -static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, +static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults) { int i; struct param_opt *data; - + fprintf(f, "# Global parameters\n[global]\n"); for (i = 0; parm_table[i].label; i++) @@ -2078,7 +2078,7 @@ static void dump_globals(struct loadparm_context *lp_ctx, FILE *f, fprintf(f, "\n"); } if (lp_ctx->globals->param_opt != NULL) { - for (data = lp_ctx->globals->param_opt; data; + for (data = lp_ctx->globals->param_opt; data; data = data->next) { fprintf(f, "\t%s = %s\n", data->key, data->value); } @@ -2094,7 +2094,7 @@ static void dump_a_service(struct loadparm_service * pService, FILE * f) { int i; struct param_opt *data; - + if (pService != &sDefault) fprintf(f, "\n[%s]\n", pService->szService); @@ -2127,20 +2127,20 @@ static void dump_a_service(struct loadparm_service * pService, FILE * f) } } -bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, - struct loadparm_service *service, +bool lp_dump_a_parameter(struct loadparm_context *lp_ctx, + struct loadparm_service *service, const char *parm_name, FILE * f) { struct parm_struct *parm; void *ptr; - + parm = lp_parm_struct(parm_name); if (!parm) { return false; } ptr = lp_parm_ptr(lp_ctx, service,parm); - + print_parameter(parm, ptr, f); fprintf(f, "\n"); return true; @@ -2199,7 +2199,7 @@ struct parm_struct *lp_next_parameter(struct loadparm_context *lp_ctx, int snum, /** * Auto-load some home services. */ -static void lp_add_auto_services(struct loadparm_context *lp_ctx, +static void lp_add_auto_services(struct loadparm_context *lp_ctx, const char *str) { return; @@ -2210,8 +2210,8 @@ static void lp_add_auto_services(struct loadparm_context *lp_ctx, * Unload unused services. */ -void lp_killunused(struct loadparm_context *lp_ctx, - struct smbsrv_connection *smb, +void lp_killunused(struct loadparm_context *lp_ctx, + struct smbsrv_connection *smb, bool (*snumused) (struct smbsrv_connection *, int)) { int i; @@ -2279,7 +2279,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) } lp_do_global_parameter(lp_ctx, "share backend", "classic"); - + lp_do_global_parameter(lp_ctx, "server role", "standalone"); /* options that can be set on the command line must be initialised via @@ -2315,7 +2315,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) data from the sam, but for the moment leave it in a tdb to keep regedt32 from popping up an annoying dialog. */ lp_do_global_parameter(lp_ctx, "registry:HKEY_USERS", "hku.ldb"); - + /* using UTF8 by default allows us to support all chars */ lp_do_global_parameter(lp_ctx, "unix charset", "UTF8"); @@ -2333,10 +2333,10 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lp_do_global_parameter(lp_ctx, "ncalrpc dir", dyn_NCALRPCDIR); lp_do_global_parameter(lp_ctx, "socket address", "0.0.0.0"); - lp_do_global_parameter_var(lp_ctx, "server string", + lp_do_global_parameter_var(lp_ctx, "server string", "Samba %s", SAMBA_VERSION_STRING); - lp_do_global_parameter_var(lp_ctx, "announce version", "%d.%d", + lp_do_global_parameter_var(lp_ctx, "announce version", "%d.%d", DEFAULT_MAJOR_VERSION, DEFAULT_MINOR_VERSION); @@ -2366,7 +2366,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lp_do_global_parameter(lp_ctx, "LanmanAuth", "True"); lp_do_global_parameter(lp_ctx, "NTLMAuth", "True"); lp_do_global_parameter(lp_ctx, "client use spnego principal", "False"); - + lp_do_global_parameter(lp_ctx, "UnixExtensions", "False"); lp_do_global_parameter(lp_ctx, "PreferredMaster", "Auto"); @@ -2405,7 +2405,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lp_do_global_parameter(lp_ctx, "tls certfile", "tls/cert.pem"); lp_do_global_parameter(lp_ctx, "tls cafile", "tls/ca.pem"); lp_do_global_parameter_var(lp_ctx, "js include", "%s", dyn_JSDIR); - lp_do_global_parameter_var(lp_ctx, "setup directory", "%s", + lp_do_global_parameter_var(lp_ctx, "setup directory", "%s", dyn_SETUPDIR); lp_do_global_parameter(lp_ctx, "prefork children:smb", "4"); @@ -2430,7 +2430,7 @@ bool lp_load_default(struct loadparm_context *lp_ctx) } /** - * Load the services array from the services file. + * Load the services array from the services file. * * Return True on success, False on failure. */ @@ -2442,11 +2442,11 @@ bool lp_load(struct loadparm_context *lp_ctx, const char *filename) filename = talloc_strdup(lp_ctx, filename); lp_ctx->szConfigFile = filename; - + lp_ctx->bInGlobalSection = true; n2 = standard_sub_basic(lp_ctx, lp_ctx->szConfigFile); DEBUG(2, ("lp_load: refreshing parameters from %s\n", n2)); - + add_to_file_list(lp_ctx, lp_ctx->szConfigFile, n2); /* We get sections first, so have to start 'behind' to make up */ @@ -2494,7 +2494,7 @@ int lp_numservices(struct loadparm_context *lp_ctx) * Display the contents of the services array in human-readable form. */ -void lp_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults, +void lp_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults, int maxtoprint) { int iService; @@ -2528,14 +2528,14 @@ struct loadparm_service *lp_servicebynum(struct loadparm_context *lp_ctx, return lp_ctx->services[snum]; } -struct loadparm_service *lp_service(struct loadparm_context *lp_ctx, +struct loadparm_service *lp_service(struct loadparm_context *lp_ctx, const char *service_name) { int iService; char *serviceName; for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--) { - if (lp_ctx->services[iService] && + if (lp_ctx->services[iService] && lp_ctx->services[iService]->szService) { /* * The substitution here is used to support %U is @@ -2555,7 +2555,7 @@ struct loadparm_service *lp_service(struct loadparm_context *lp_ctx, /** - * A useful volume label function. + * A useful volume label function. */ const char *volume_label(struct loadparm_service *service) { @@ -2609,10 +2609,10 @@ _PUBLIC_ void reload_charcnv(struct loadparm_context *lp_ctx) lp_ctx->iconv_convenience = smb_iconv_convenience_init_lp(lp_ctx, lp_ctx); } -void lp_smbcli_options(struct loadparm_context *lp_ctx, +void lp_smbcli_options(struct loadparm_context *lp_ctx, struct smbcli_options *options) { - options->max_xmit = lp_max_xmit(lp_ctx); + options->max_xmit = lp_max_xmit(lp_ctx); options->max_mux = lp_maxmux(lp_ctx); options->use_spnego = lp_nt_status_support(lp_ctx) && lp_use_spnego(lp_ctx); options->signing = lp_client_signing(lp_ctx); -- cgit From f22598a95c5a42c6453f11e5e95c720e8b61c4fc Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 13 Feb 2008 23:35:43 +0100 Subject: util_ldb: Add a missing \n to debug string, fix trailing whitespaces. (This used to be commit b0991cc09b36171c18d2407c9f3153b6f7e8299b) --- source4/lib/util/util_ldb.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source4') diff --git a/source4/lib/util/util_ldb.c b/source4/lib/util/util_ldb.c index a8719af190..f1b42effd8 100644 --- a/source4/lib/util/util_ldb.c +++ b/source4/lib/util/util_ldb.c @@ -1,21 +1,21 @@ -/* +/* Unix SMB/CIFS implementation. common share info functions Copyright (C) Andrew Tridgell 2004 Copyright (C) Tim Potter 2004 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -56,7 +56,7 @@ int gendb_search_v(struct ldb_context *ldb, if (ret == LDB_SUCCESS) { talloc_steal(mem_ctx, res->msgs); - DEBUG(6,("gendb_search_v: %s %s -> %d\n", + DEBUG(6,("gendb_search_v: %s %s -> %d\n", basedn?ldb_dn_get_linearized(basedn):"NULL", expr?expr:"NULL", res->count)); @@ -67,7 +67,8 @@ int gendb_search_v(struct ldb_context *ldb, ret = 0; *msgs = NULL; } else { - DEBUG(4,("gendb_search_v: search failed: %s", ldb_errstring(ldb))); + DEBUG(4,("gendb_search_v: search failed: %s\n", + ldb_errstring(ldb))); ret = -1; } @@ -80,7 +81,7 @@ int gendb_search_v(struct ldb_context *ldb, search the LDB for the specified attributes - varargs variant */ int gendb_search(struct ldb_context *ldb, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn *basedn, struct ldb_message ***res, const char * const *attrs, @@ -101,7 +102,7 @@ int gendb_search(struct ldb_context *ldb, */ int gendb_search_dn(struct ldb_context *ldb, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, struct ldb_dn *dn, struct ldb_message ***res, const char * const *attrs) -- cgit From f3bbe1516c95ac29b3ff51a2b5a91105d315524b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 14 Feb 2008 23:10:00 +0100 Subject: Fix path to talloc guide. Noted by "teferi" on irc. Michael (This used to be commit bc4e03f2ddb669758e27e2a5c32e15c7d6c5257d) --- source4/lib/talloc/web/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/lib/talloc/web/index.html b/source4/lib/talloc/web/index.html index 106920e8a5..e53e8960a8 100644 --- a/source4/lib/talloc/web/index.html +++ b/source4/lib/talloc/web/index.html @@ -12,7 +12,7 @@ destructors. It is the core memory allocator used in Samba4, and has made a huge difference in many aspects of Samba4 development.

To get started with talloc, I would recommend you read the talloc guide. +href="http://samba.org/ftp/unpacked/samba_4_0_test/source/lib/talloc/talloc_guide.txt">talloc guide.

Discussion and bug reports

-- cgit From 60b314428008878f949b9fba54825c2f4f900288 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 13:29:32 +1100 Subject: fixed loadparm handling in standalone tests (This used to be commit 2633f4259ed30ab990017c4c3205f92bf38f0135) --- source4/torture/gentest.c | 2 +- source4/torture/locktest.c | 2 +- source4/torture/masktest.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index d50393baf0..8fa433a872 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -2205,7 +2205,7 @@ static bool split_unc_name(const char *unc, char **server, char **share) argc -= NSERVERS; argv += NSERVERS; - lp_ctx = loadparm_init(talloc_autofree_context()); + global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context()); lp_load(lp_ctx, dyn_CONFIGFILE); servers[0].credentials = cli_credentials_init(talloc_autofree_context()); diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 90e2eec2be..119b5186d9 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -572,7 +572,7 @@ static void usage(void) argc -= NSERVERS; argv += NSERVERS; - lp_ctx = loadparm_init(talloc_autofree_context()); + global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context()); lp_load(lp_ctx, dyn_CONFIGFILE); servers[0] = cli_credentials_init(talloc_autofree_context()); diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index d1b853de72..855da54340 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -325,7 +325,7 @@ static void usage(void) argc -= 1; argv += 1; - lp_ctx = loadparm_init(talloc_autofree_context()); + global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context()); lp_load(lp_ctx, dyn_CONFIGFILE); credentials = cli_credentials_init(talloc_autofree_context()); -- cgit From be8a09b13883eb6edd55dedd4dbb45906be20311 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 14:11:11 +1100 Subject: add some info on running tests (This used to be commit b6ba0afc1424a1d202626aabf1cd0f28246319a6) --- source4/selftest/README | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source4') diff --git a/source4/selftest/README b/source4/selftest/README index 3250f32ec7..e8e87c8b3f 100644 --- a/source4/selftest/README +++ b/source4/selftest/README @@ -39,3 +39,24 @@ The following environments are currently available: * DOMAIN: Domain name * REALM: Realm name * SERVER: Name of the member server + + +============= +Running tests +============= + +To run all the tests use: + + make test + +To run a quick subset (aiming for about 1 minute of testing) run: + + make quicktest + +To run a specific test, use this syntax + + make test TESTS=testname + +for example + + make test TESTS=samba4.BASE-DELETE -- cgit From 63c099c51a71afad67dce2d2df842b934412117b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 14:27:06 +1100 Subject: added blackbox testing for locktest (This used to be commit af6484f78d273407dd9b264bc4adb33497eee48b) --- source4/selftest/samba4_tests.sh | 1 + source4/selftest/target/Samba4.pm | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 2595d51177..8be55f78b0 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -253,6 +253,7 @@ plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PAS plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" +plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" # Tests using the "Simple" NTVFS backend diff --git a/source4/selftest/target/Samba4.pm b/source4/selftest/target/Samba4.pm index fba0f6a6f8..563aca876e 100644 --- a/source4/selftest/target/Samba4.pm +++ b/source4/selftest/target/Samba4.pm @@ -525,7 +525,7 @@ sub provision($$$$$$) (system("rm -rf $prefix/*") == 0) or die("Unable to clean up"); mkdir($_, 0777) foreach ($privatedir, $etcdir, $piddir, $ncalrpcdir, $lockdir, - $tmpdir); + $tmpdir, "$tmpdir/test1", "$tmpdir/test2"); my $localbasedn = $basedn; @@ -569,6 +569,20 @@ sub provision($$$$$$) posix:sharedelay = 100000 posix:eadb = $lockdir/eadb.tdb +[test1] + path = $tmpdir/test1 + read only = no + ntvfs handler = posix + posix:sharedelay = 100000 + posix:eadb = $lockdir/eadb.tdb + +[test2] + path = $tmpdir/test2 + read only = no + ntvfs handler = posix + posix:sharedelay = 100000 + posix:eadb = $lockdir/eadb.tdb + [cifs] read only = no ntvfs handler = cifs -- cgit From 66e8bc9dac291946986d1eb202fc2ed584330118 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 14:55:31 +1100 Subject: converted locktest to use popt and cmdline utility code (This used to be commit 625ea49a95cbdb507ea5b191f75ffa27e25cdb90) --- source4/selftest/samba4_tests.sh | 2 +- source4/torture/config.mk | 3 + source4/torture/locktest.c | 162 ++++++++++++++++----------------------- 3 files changed, 72 insertions(+), 95 deletions(-) (limited to 'source4') diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 8be55f78b0..ab7065c6f0 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -253,7 +253,7 @@ plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PAS plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" -plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" +plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" # Tests using the "Simple" NTVFS backend diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 0c5e641b4b..18e5ea70ec 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -362,6 +362,9 @@ INSTALLDIR = BINDIR OBJ_FILES = \ locktest.o PRIVATE_DEPENDENCIES = \ + LIBPOPT \ + POPT_SAMBA \ + POPT_CREDENTIALS \ LIBSAMBA-UTIL \ LIBCLI_SMB \ LIBSAMBA-CONFIG diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 119b5186d9..ebc325fe2b 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/filesys.h" #include "system/time.h" #include "pstring.h" @@ -29,15 +30,15 @@ #include "libcli/resolve/resolve.h" static int numops = 1000; -static bool showall; -static bool analyze; -static bool hide_unlock_fails; -static bool use_oplocks; +static int showall; +static int analyze; +static int hide_unlock_fails; +static int use_oplocks; static uint_t lock_range = 100; static uint_t lock_base = 0; static uint_t min_length = 0; -static bool exact_error_codes; -static bool zero_zero; +static int exact_error_codes; +static int zero_zero; #define FILENAME "\\locktest.dat" @@ -520,26 +521,10 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) -static void usage(void) +_NORETURN_ static void usage(poptContext pc) { - printf( -"Usage:\n\ - locktest //server1/share1 //server2/share2 [options..]\n\ - options:\n\ - -U user%%pass (may be specified twice)\n\ - -s seed\n\ - -o numops\n\ - -u hide unlock fails\n\ - -a (show all ops)\n\ - -A analyse for minimal ops\n\ - -O use oplocks\n\ - -E enable exact error code checking\n\ - -Z enable the zero/zero lock\n\ - -R range set lock range\n\ - -B base set lock base\n\ - -M min set min lock length\n\ - -l filename unclist file\n\ -"); + printf("Usage:\n\tlocktest //server1/share1 //server2/share2 [options..]\n"); + poptPrintUsage(pc, stdout, 0); } /**************************************************************************** @@ -552,97 +537,86 @@ static void usage(void) int seed, server; int username_count=0; struct loadparm_context *lp_ctx; + poptContext pc; + int argc_new, i; + char **argv_new; + enum {OPT_UNCLIST=1000}; + struct poptOption long_options[] = { + POPT_AUTOHELP + {"seed", 0, POPT_ARG_INT, &seed, 0, "Seed to use for randomizer", NULL}, + {"num-ops", 0, POPT_ARG_INT, &numops, 0, "num ops", NULL}, + {"lockrange", 0, POPT_ARG_INT, &lock_range,0, "locking range", NULL}, + {"lockbase", 0, POPT_ARG_INT, &lock_base, 0, "locking base", NULL}, + {"minlength", 0, POPT_ARG_INT, &min_length,0, "min lock length", NULL}, + {"hidefails", 0, POPT_ARG_NONE, &hide_unlock_fails,0,"hide unlock fails", NULL}, + {"oplocks", 0, POPT_ARG_NONE, &use_oplocks,0, "use oplocks", NULL}, + {"showall", 0, POPT_ARG_NONE, &showall, 0, "display all operations", NULL}, + {"analyse", 0, POPT_ARG_NONE, &analyze, 0, "do backtrack analysis", NULL}, + {"zerozero", 0, POPT_ARG_NONE, &zero_zero, 0, "do zero/zero lock", NULL}, + {"exacterrors", 0, POPT_ARG_NONE, &exact_error_codes,0,"use exact error codes", NULL}, + {"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL}, + { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" }, + POPT_COMMON_SAMBA + POPT_COMMON_CONNECTION + POPT_COMMON_CREDENTIALS + POPT_COMMON_VERSION + { NULL } + }; setlinebuf(stdout); + seed = time(NULL); - setup_logging("locktest", DEBUG_STDOUT); - - if (argc < 3 || argv[1][0] == '-') { - usage(); - exit(1); - } - - setup_logging(argv[0], DEBUG_STDOUT); - - for (server=0;server "); servers[0] = cli_credentials_init(talloc_autofree_context()); servers[1] = cli_credentials_init(talloc_autofree_context()); cli_credentials_guess(servers[0], lp_ctx); cli_credentials_guess(servers[1], lp_ctx); - seed = time(NULL); - - while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:l:")) != EOF) { + while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; case 'U': if (username_count == 2) { - usage(); + usage(pc); exit(1); } - cli_credentials_parse_string(servers[username_count], - optarg, CRED_SPECIFIED); + cli_credentials_parse_string(servers[username_count], poptGetOptArg(pc), CRED_SPECIFIED); username_count++; break; - case 'R': - lock_range = strtol(optarg, NULL, 0); - break; - case 'B': - lock_base = strtol(optarg, NULL, 0); - break; - case 'M': - min_length = strtol(optarg, NULL, 0); - break; - case 's': - seed = atoi(optarg); - break; - case 'u': - hide_unlock_fails = true; - break; - case 'o': - numops = atoi(optarg); - break; - case 'O': - use_oplocks = true; - break; - case 'a': - showall = true; - break; - case 'A': - analyze = true; - break; - case 'Z': - zero_zero = true; - break; - case 'E': - exact_error_codes = true; - break; - case 'l': - lp_set_cmdline(lp_ctx, "torture:unclist", optarg); - break; - case 'W': - lp_set_cmdline(lp_ctx, "workgroup", optarg); + } + } + + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i= 3)) { + usage(pc); + exit(1); + } + + setup_logging("locktest", DEBUG_STDOUT); + + for (server=0;server Date: Fri, 15 Feb 2008 15:26:20 +1100 Subject: fixed masktest to use popt, and fixed the incorrect pstring conversion (This used to be commit c37133fd95e6d02a0cdf0f7b5408211740d8046c) --- source4/torture/masktest.c | 157 ++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 94 deletions(-) (limited to 'source4') diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index 855da54340..ac7029aa50 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/filesys.h" #include "system/dir.h" #include "libcli/libcli.h" @@ -30,12 +31,10 @@ #include "dynconfig.h" #include "libcli/resolve/resolve.h" -static struct cli_credentials *credentials; static bool showall = false; static bool old_list = false; static const char *maskchars = "<>\"?*abc."; static const char *filechars = "abcdefghijklm."; -static int verbose; static int die_on_error; static int NumLoops = 0; static int max_length = 20; @@ -87,13 +86,13 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, *share = 0; share++; - cli_credentials_set_workstation(credentials, "masktest", CRED_SPECIFIED); + cli_credentials_set_workstation(cmdline_credentials, "masktest", CRED_SPECIFIED); status = smbcli_full_connection(NULL, &c, server, ports, share, NULL, - credentials, resolve_ctx, NULL, + cmdline_credentials, resolve_ctx, NULL, options); if (!NT_STATUS_IS_OK(status)) { @@ -112,7 +111,7 @@ static bool f_info_hit; static void listfn(struct clilist_file_info *f, const char *s, void *state) { - struct masktest_state *m = talloc_get_type(state,struct masktest_state); + struct masktest_state *m = (struct masktest_state *)state; if (ISDOT(f->name)) { resultp[0] = '+'; @@ -128,7 +127,7 @@ static void listfn(struct clilist_file_info *f, const char *s, void *state) } static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, - char *long_name, fstring short_name) + char **long_name, fstring short_name) { const char *mask; struct masktest_state state; @@ -151,12 +150,12 @@ static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, if (f_info_hit) { fstrcpy(short_name, last_hit.short_name); strlower(short_name); - long_name = talloc_strdup(mem_ctx, last_hit.long_name); - strlower(long_name); + *long_name = talloc_strdup(mem_ctx, last_hit.long_name); + strlower(*long_name); } if (*short_name == '\0') { - fstrcpy(short_name, long_name); + fstrcpy(short_name, *long_name); } } @@ -168,7 +167,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask, char *res2; static int count; fstring short_name; - char *long_name; + char *long_name = NULL; struct masktest_state state; count++; @@ -186,7 +185,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask, resultp = res1; fstrcpy(short_name, ""); - get_real_name(mem_ctx, cli, long_name, short_name); + get_real_name(mem_ctx, cli, &long_name, short_name); fstrcpy(res1, "---"); smbcli_list_new(cli->tree, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, @@ -241,6 +240,8 @@ static void test_mask(int argc, char *argv[], l2 = 1 + random() % max_length; mask = talloc_strdup(mem_ctx, "\\masktest\\"); file = talloc_strdup(mem_ctx, "\\masktest\\"); + mask = talloc_realloc_size(mem_ctx, mask, strlen(mask)+l1+1); + file = talloc_realloc_size(mem_ctx, file, strlen(file)+l2+1); l = strlen(mask); for (i=0;i"); - share = argv[1]; - - all_string_sub(share,"/","\\",0); + while((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; + } + } - setup_logging(argv[0], DEBUG_STDOUT); + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i= 2)) { + usage(pc); + exit(1); + } - global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context()); - lp_load(lp_ctx, dyn_CONFIGFILE); + setup_logging("masktest", DEBUG_STDOUT); - credentials = cli_credentials_init(talloc_autofree_context()); - cli_credentials_guess(credentials, lp_ctx); + share = argv_new[1]; - seed = time(NULL); + all_string_sub(share,"/","\\",0); - while ((opt = getopt(argc, argv, "n:d:U:s:hm:f:aoW:M:vEl:")) != EOF) { - switch (opt) { - case 'n': - NumLoops = atoi(optarg); - break; - case 'd': - DEBUGLEVEL = atoi(optarg); - break; - case 'E': - die_on_error = 1; - break; - case 'v': - verbose++; - break; - case 'M': - lp_set_cmdline(lp_ctx, "max protocol", optarg); - break; - case 'U': - cli_credentials_parse_string(credentials, optarg, CRED_SPECIFIED); - break; - case 's': - seed = atoi(optarg); - break; - case 'h': - usage(); - exit(1); - case 'm': - maskchars = optarg; - break; - case 'l': - max_length = atoi(optarg); - break; - case 'f': - filechars = optarg; - break; - case 'a': - showall = 1; - break; - case 'o': - old_list = true; - break; - default: - printf("Unknown option %c (%d)\n", (char)opt, opt); - exit(1); - } - } + lp_ctx = cmdline_lp_ctx; gensec_init(lp_ctx); - argc -= optind; - argv += optind; - lp_smbcli_options(lp_ctx, &options); cli = connect_one(lp_resolve_context(lp_ctx), share, @@ -398,7 +367,7 @@ static void usage(void) DEBUG(0,("seed=%d format --- --- (server, correct)\n", seed)); srandom(seed); - test_mask(argc, argv, cli); + test_mask(argc_new-1, argv_new+1, cli); return(0); } -- cgit From c09f70608c97c5df87818f0c6297e85cf8827862 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:33:10 +1100 Subject: added a blackbox test for masktest (This used to be commit 05a110123df2372418e2ef2fd8f269b92054069c) --- source4/selftest/samba4_tests.sh | 1 + source4/torture/locktest.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index ab7065c6f0..98eade4e41 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -254,6 +254,7 @@ plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$P plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" # Tests using the "Simple" NTVFS backend diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index ebc325fe2b..fb2430f881 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -396,7 +396,7 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], we then do random locking ops in tamdem on the 4 fnums from each server and ensure that the results match */ -static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) +static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) { struct smbcli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; @@ -451,7 +451,12 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) open_files(cli, fnum); n = retest(cli, fnum, numops); - if (n == numops || !analyze) return; + if (n == numops || !analyze) { + if (n != numops) { + return 1; + } + return 0; + } n++; skip = n/2; @@ -517,6 +522,8 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) (double)recorded[i].len, recorded[i].needed); } + + return 1; } @@ -632,8 +639,6 @@ _NORETURN_ static void usage(poptContext pc) seed, lock_base, lock_range, min_length)); srandom(seed); - test_locks(lp_ctx, share); - - return(0); + return test_locks(lp_ctx, share); } -- cgit From 80362574b83eaa27c4fcf8f93546f8700fc736c8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:39:07 +1100 Subject: fix typo (This used to be commit 1699b2a804cf91175de2528c1e640a09b4de4f08) --- source4/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index fb2430f881..de25c0abc8 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -573,7 +573,7 @@ _NORETURN_ static void usage(poptContext pc) setlinebuf(stdout); seed = time(NULL); - pc = poptGetContext("locjtest", argc, (const char **) argv, long_options, + pc = poptGetContext("locktest", argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); poptSetOtherOptionHelp(pc, " "); -- cgit From 9e6327dc41c8f3a4b523ccbab869e6b001e1b6df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:52:52 +1100 Subject: make sure lp_ctx is initialised (This used to be commit 3abb33c8bff9aac8ba1ba4783b919732e5159283) --- source4/torture/locktest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index de25c0abc8..039484a8cb 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -528,7 +528,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) -_NORETURN_ static void usage(poptContext pc) +static void usage(poptContext pc) { printf("Usage:\n\tlocktest //server1/share1 //server2/share2 [options..]\n"); poptPrintUsage(pc, stdout, 0); @@ -578,6 +578,7 @@ _NORETURN_ static void usage(poptContext pc) poptSetOtherOptionHelp(pc, " "); + lp_ctx = cmdline_lp_ctx; servers[0] = cli_credentials_init(talloc_autofree_context()); servers[1] = cli_credentials_init(talloc_autofree_context()); cli_credentials_guess(servers[0], lp_ctx); -- cgit From db408c0d0dbe159146c637c97bbe9bbf41983586 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:53:11 +1100 Subject: convert gentest to use popt and the cmdline library (This used to be commit 681366b956a71aa7bd16b75263ccd73ddc680082) --- source4/torture/gentest.c | 166 +++++++++++++++++++++++----------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'source4') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 8fa433a872..28cac81624 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/raw/request.h" @@ -1755,6 +1756,7 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) info->end_of_file_info.in.size = gen_offset(); break; case RAW_SFILEINFO_RENAME_INFORMATION: + case RAW_SFILEINFO_RENAME_INFORMATION_SMB2: info->rename_information.in.overwrite = gen_bool(); info->rename_information.in.root_fid = gen_root_fid(instance); info->rename_information.in.new_name = gen_fname_open(instance); @@ -2129,25 +2131,13 @@ static bool start_gentest(struct loadparm_context *lp_ctx) } -static void usage(void) +static void usage(poptContext pc) { printf( "Usage:\n\ - gentest2 //server1/share1 //server2/share2 [options..]\n\ - options:\n\ - -U user%%pass (can be specified twice)\n\ - -s seed\n\ - -o numops\n\ - -a (show all ops)\n\ - -A backtrack to find minimal ops\n\ - -i FILE add a list of wildcard exclusions\n\ - -O enable oplocks\n\ - -S FILE set preset seeds file\n\ - -L use preset seeds\n\ - -F fast reconnect (just close files)\n\ - -C continuous analysis mode\n\ - -X analyse even when test OK\n\ + gentest //server1/share1 //server2/share2 [options..]\n\ "); + poptPrintUsage(pc, stdout, 0); } /** @@ -2180,14 +2170,88 @@ static bool split_unc_name(const char *unc, char **server, char **share) int opt; int i, username_count=0; bool ret; + char *ignore_file=NULL; struct loadparm_context *lp_ctx; + poptContext pc; + int argc_new; + char **argv_new; + enum {OPT_UNCLIST=1000}; + struct poptOption long_options[] = { + POPT_AUTOHELP + {"seed", 0, POPT_ARG_INT, &options.seed, 0, "Seed to use for randomizer", NULL}, + {"num-ops", 0, POPT_ARG_INT, &options.numops, 0, "num ops", NULL}, + {"oplocks", 0, POPT_ARG_NONE, &options.use_oplocks,0, "use oplocks", NULL}, + {"showall", 0, POPT_ARG_NONE, &options.showall, 0, "display all operations", NULL}, + {"analyse", 0, POPT_ARG_NONE, &options.analyze, 0, "do backtrack analysis", NULL}, + {"analysealways", 0, POPT_ARG_NONE, &options.analyze_always, 0, "analysis always", NULL}, + {"analysecontinuous", 0, POPT_ARG_NONE, &options.analyze_continuous, 0, "analysis continuous", NULL}, + {"ignore", 0, POPT_ARG_STRING, &ignore_file, 0, "ignore from file", NULL}, + {"preset", 0, POPT_ARG_NONE, &options.use_preset_seeds, 0, "use preset seeds", NULL}, + {"fast", 0, POPT_ARG_NONE, &options.fast_reconnect, 0, "use fast reconnect", NULL}, + {"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL}, + {"seedsfile", 0, POPT_ARG_STRING, &options.seeds_file, 0, "seed file", NULL}, + { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" }, + POPT_COMMON_SAMBA + POPT_COMMON_CONNECTION + POPT_COMMON_CREDENTIALS + POPT_COMMON_VERSION + { NULL } + }; + + setlinebuf(stdout); + options.seed = time(NULL); + + pc = poptGetContext("gentest", argc, (const char **) argv, long_options, + POPT_CONTEXT_KEEP_FIRST); + + poptSetOtherOptionHelp(pc, " "); + + lp_ctx = cmdline_lp_ctx; + servers[0].credentials = cli_credentials_init(talloc_autofree_context()); + servers[1].credentials = cli_credentials_init(talloc_autofree_context()); + cli_credentials_guess(servers[0].credentials, lp_ctx); + cli_credentials_guess(servers[1].credentials, lp_ctx); + + while((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; + case 'U': + if (username_count == 2) { + usage(pc); + exit(1); + } + cli_credentials_parse_string(servers[username_count].credentials, poptGetOptArg(pc), CRED_SPECIFIED); + username_count++; + break; + } + } + + if (ignore_file) { + options.ignore_patterns = file_lines_load(ignore_file, NULL, NULL); + } + + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i= 3)) { + usage(pc); + exit(1); + } setlinebuf(stdout); setup_logging("gentest", DEBUG_STDOUT); if (argc < 3 || argv[1][0] == '-') { - usage(); + usage(pc); exit(1); } @@ -2195,7 +2259,6 @@ static bool split_unc_name(const char *unc, char **server, char **share) for (i=0;i Date: Fri, 15 Feb 2008 16:42:22 +1100 Subject: added blackbox testing of gentest (This used to be commit 716345fd38dfd8c6e610fbd6ba84c4f33e3edbb9) --- source4/selftest/samba4_tests.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'source4') diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 98eade4e41..79c5c3e994 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -255,6 +255,7 @@ plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$ plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.gentest" dc $bbdir/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" # Tests using the "Simple" NTVFS backend -- cgit From 4c6ecb43949fd491939fd1392e22ab225c9e5342 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 16:52:57 +1100 Subject: fixed some options that could not be overridden on the command line (This used to be commit eea486d8942fdda769684fa6e825c0f899cf3304) --- source4/torture/gentest.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'source4') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 28cac81624..d5fc855f17 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -2200,6 +2200,9 @@ static bool split_unc_name(const char *unc, char **server, char **share) setlinebuf(stdout); options.seed = time(NULL); + options.numops = 1000; + options.max_open_handles = 20; + options.seeds_file = "gentest_seeds.dat"; pc = poptGetContext("gentest", argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); @@ -2265,16 +2268,6 @@ static bool split_unc_name(const char *unc, char **server, char **share) } } - argc -= NSERVERS; - argv += NSERVERS; - - lp_load(lp_ctx, dyn_CONFIGFILE); - - options.seed = time(NULL); - options.numops = 1000; - options.max_open_handles = 20; - options.seeds_file = "gentest_seeds.dat"; - if (username_count == 0) { usage(pc); return -1; -- cgit From 339dcbb64169abe9c1b810140eaef25a17a9a690 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 16:53:10 +1100 Subject: remove redundent code (This used to be commit 7f2421f17cae313d7dbf5c35c73b5410cb1d5db0) --- source4/torture/locktest.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 039484a8cb..618568acf9 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -633,9 +633,6 @@ static void usage(poptContext pc) gensec_init(lp_ctx); - argc -= optind; - argv += optind; - DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n", seed, lock_base, lock_range, min_length)); srandom(seed); -- cgit From 81db8319732925ce2fbf8d853feac2abb0a8a59d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 14:54:52 +0100 Subject: cyrus_sasl: fix compiler warnings metze (This used to be commit 558c717c6c279b739633e26855910b61b792e7b6) --- source4/auth/gensec/cyrus_sasl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/auth/gensec/cyrus_sasl.c b/source4/auth/gensec/cyrus_sasl.c index 64a0b2f0c7..cb7bcb71d8 100644 --- a/source4/auth/gensec/cyrus_sasl.c +++ b/source4/auth/gensec/cyrus_sasl.c @@ -362,8 +362,11 @@ int gensec_sasl_log(void *context, NTSTATUS gensec_sasl_init(void) { NTSTATUS ret; - int sasl_ret, i; + int sasl_ret; +#if 0 + int i; const char **sasl_mechs; +#endif static const sasl_callback_t callbacks[] = { { -- cgit From 17f31a7677a585834d8d172a67bf39bfda048a46 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 14:56:58 +0100 Subject: NET-API-BECOME-DC: at least find the 'provision' function in python mode This is still broken, as we call provision() with wrong arguments. Also the python provision() function, doesn't allow us to specify the locations of the partition ldb files, this is strictly needed otherwise the torture test destroys a production databases. I think we should have a provision_become_dc() again! metze (This used to be commit 096eafd34778dde222bce4b0a5c0fc38b7de0359) --- source4/torture/libnet/libnet_BecomeDC.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 0dd06bda4c..997dbc93b8 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -284,6 +284,7 @@ static NTSTATUS test_become_dc_prepare_db_py(void *private_data, { struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state); bool ok; + PyObject *module, *module_dict; PyObject *provision_fn, *result, *parameters; DEBUG(0,("Provision for Become-DC test using PYTHON\n")); @@ -293,13 +294,24 @@ static NTSTATUS test_become_dc_prepare_db_py(void *private_data, py_update_path("bin"); /* FIXME: Can't assume this always runs in source/... */ - provision_fn = PyImport_Import(PyString_FromString("samba.provision.provision")); + module = PyImport_Import(PyString_FromString("samba.provision")); + if (module == NULL) { + DEBUG(0, ("Unable to import 'samba.provision' Python module.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + module_dict = PyModule_GetDict(module); + if (module_dict == NULL) { + DEBUG(0, ("Unable to GetDict of 'samba.provision'.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + provision_fn = PyDict_GetItemString(module_dict, "provision"); if (provision_fn == NULL) { - DEBUG(0, ("Unable to import provision Python module.\n")); - return NT_STATUS_UNSUCCESSFUL; + DEBUG(0, ("Unable to get function 'provision' of 'samba.provision'.\n")); + return NT_STATUS_UNSUCCESSFUL; } - + DEBUG(0,("New Server[%s] in Site[%s]\n", p->dest_dsa->dns_name, p->dest_dsa->site_name)); -- cgit From 80d7c3ef7de5fb100807f30e84aff10ef48afa08 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Feb 2008 17:31:17 +0100 Subject: krb5pac.idl: use charset() instead of string type with flags metze (This used to be commit 30657ae0ebdb85ae995a3dfe3ce123851fd92e0f) --- source4/librpc/idl/krb5pac.idl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/librpc/idl/krb5pac.idl b/source4/librpc/idl/krb5pac.idl index fa6bf51e44..efd4aa860f 100644 --- a/source4/librpc/idl/krb5pac.idl +++ b/source4/librpc/idl/krb5pac.idl @@ -16,7 +16,8 @@ interface krb5pac { typedef struct { NTTIME logon_time; - [flag(STR_SIZE2|STR_NOTERM|STR_BYTESIZE)] string account_name; + [value(2*strlen_m(account_name))] uint16 size; + [charset(UTF16)] uint8 account_name[size]; } PAC_LOGON_NAME; typedef [public,flag(NDR_PAHEX)] struct { -- cgit From f9116ae6db3c10ede2ce55040bc79c7624064bc0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 15:02:11 +0100 Subject: drsuapi.idl: use charset() instead of the exotic flags() and string metze (This used to be commit 70c7faace76a84d2fe15accf4f8a1ca0ad905bd4) --- source4/librpc/idl/drsuapi.idl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl index f298b7e321..fb24122e26 100644 --- a/source4/librpc/idl/drsuapi.idl +++ b/source4/librpc/idl/drsuapi.idl @@ -130,7 +130,8 @@ interface drsuapi [value(ndr_size_dom_sid28(&sid, ndr->flags))] uint32 __ndr_size_sid; GUID guid; dom_sid28 sid; - [flag(STR_SIZE4|STR_CHARLEN|STR_CONFORMANT)] string dn; + [value(strlen_m(dn))] uint32 __ndr_size_dn; + [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[]; } drsuapi_DsReplicaObjectIdentifier; typedef [public] bitmap { @@ -451,7 +452,8 @@ interface drsuapi [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid; GUID guid; dom_sid28 sid; - [flag(STR_SIZE4|STR_CHARLEN)] string dn; + [value(strlen_m(dn))] uint32 __ndr_size_dn; + [charset(UTF16)] uint16 dn[__ndr_size_dn+1]; } drsuapi_DsReplicaObjectIdentifier3; typedef [public,gensize] struct { @@ -459,7 +461,8 @@ interface drsuapi [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid; GUID guid; dom_sid28 sid; - [flag(STR_SIZE4|STR_CHARLEN)] string dn; + [value(strlen_m(dn))] uint32 __ndr_size_dn; + [charset(UTF16)] uint16 dn[__ndr_size_dn+1]; [value(binary.length + 4)] uint32 __ndr_size_binary; [flag(NDR_REMAINING)] DATA_BLOB binary; } drsuapi_DsReplicaObjectIdentifier3Binary; -- cgit From a37ddb8ae0fe52b4adea3c35bd4e6e85b909d83f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 15:03:37 +0100 Subject: ndr_sec_helper: create a completely zero sid, so that ndr_size_dom_sid28 can return 0 metze (This used to be commit ae6976eb4a8ddafc40ce91f68c9bca861502093b) --- source4/librpc/ndr/ndr_sec_helper.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4') diff --git a/source4/librpc/ndr/ndr_sec_helper.c b/source4/librpc/ndr/ndr_sec_helper.c index 30eaf9c6f4..5a0178bd25 100644 --- a/source4/librpc/ndr/ndr_sec_helper.c +++ b/source4/librpc/ndr/ndr_sec_helper.c @@ -187,6 +187,9 @@ enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct if (!NDR_ERR_CODE_IS_SUCCESS(status)) { /* handle a w2k bug which send random data in the buffer */ ZERO_STRUCTP(sid); + } else if (sid->num_auths == 0 && sid->sub_auths) { + talloc_free(sid->sub_auths); + sid->sub_auths = NULL; } return NDR_ERR_SUCCESS; -- cgit From 8410878e2a6c270a50ee1cfa73c9d115a0666dd8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 15:01:23 +0100 Subject: dcerpc.idl: use charset() instead of ascstr3 metze (This used to be commit 47447f60bc8e5dd1021752e9b011f22762e45eed) --- source4/librpc/idl/dcerpc.idl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/librpc/idl/dcerpc.idl b/source4/librpc/idl/dcerpc.idl index fcb0be4639..b2c67542f5 100644 --- a/source4/librpc/idl/dcerpc.idl +++ b/source4/librpc/idl/dcerpc.idl @@ -64,7 +64,8 @@ interface dcerpc uint16 max_xmit_frag; uint16 max_recv_frag; uint32 assoc_group_id; - ascstr3 secondary_address; + [value(strlen(secondary_address)+1)] uint16 secondary_address_size; + [charset(DOS)] uint8 secondary_address[secondary_address_size]; [flag(NDR_ALIGN4)] DATA_BLOB _pad1; uint8 num_results; dcerpc_ack_ctx ctx_list[num_results]; -- cgit From 7f4d2ac6a2a9c3a8692d52b573c91651dacd5820 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 16:07:49 +0100 Subject: epmapper.idl: add link to official IDL metze (This used to be commit b5c0a6c114b5c832f742bd84179e5e9a5aed3698) --- source4/librpc/idl/epmapper.idl | 1 + 1 file changed, 1 insertion(+) (limited to 'source4') diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index baf9f23877..675ba89ee6 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -3,6 +3,7 @@ /* endpoint mapper interface Related links: + http://www.opengroup.org/onlinepubs/9629399/apdxo.htm : The official IDL for this pipe http://www.opengroup.org/onlinepubs/9629399/apdxl.htm : Details on towers http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: binding strings -- cgit From 1b09ec14a8f5e33ce4a6f41cf9d4ca8e53df4c87 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 16:08:17 +0100 Subject: epmapper.idl: don't use ascstr2 anymore metze (This used to be commit 96f1ad6d27fdfecd3a07a05052c8085d66472106) --- source4/librpc/idl/epmapper.idl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index 675ba89ee6..60ff338ec4 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -223,7 +223,16 @@ interface epmapper typedef struct { GUID object; epm_twr_t *tower; - ascstr2 annotation; + /* + * In theory this should be: + * [charset(DOS),string] uint8 annotation[64] + * But midl treats this as: + * [charset(DOS),string] uint8 annotation[] + * and pidl doesn't support this yet + */ + [value(0)] uint32 __annotation_offset; + [value(strlen(annotation)+1)] uint32 __annotation_length; + [charset(DOS)] uint8 annotation[__annotation_length]; } epm_entry_t; typedef struct { -- cgit From de3d54e0559ee5ae9aa6810a3eaf4f237dbc5ae5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 16:08:50 +0100 Subject: lsa.idl: don't use ascstr_noterm anymore metze (This used to be commit b994f899b42d294c0418bdc82660a2f7510667d6) --- source4/librpc/idl/lsa.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index 8d26ec0aad..c2b7b5b58a 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -33,9 +33,9 @@ import "security.idl"; } lsa_Strings; typedef [public] struct { - [value(strlen_m(string))] uint16 length; - [value(strlen_m(string))] uint16 size; - ascstr_noterm *string; + [value(strlen(string))] uint16 length; + [value(strlen(string))] uint16 size; + [charset(DOS),size_is(size),length_is(length)] uint8 *string; } lsa_AsciiString; /******************/ -- cgit From 9d9d54430aed677ae33e51fda5da7b4306c734f1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 15 Feb 2008 14:56:07 +0100 Subject: lsa.idl: add lsa_AsciiStringLarge metze (This used to be commit 646c597b79cb01474ed8139e4e790206bd84632c) --- source4/librpc/idl/lsa.idl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4') diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index c2b7b5b58a..bc5ccaa78a 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -38,6 +38,12 @@ import "security.idl"; [charset(DOS),size_is(size),length_is(length)] uint8 *string; } lsa_AsciiString; + typedef [public] struct { + [value(strlen(string))] uint16 length; + [value(strlen(string)+1)] uint16 size; + [charset(DOS),size_is(size),length_is(length)] uint8 *string; + } lsa_AsciiStringLarge; + /******************/ /* Function: 0x00 */ NTSTATUS lsa_Close ( -- cgit