summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-15 23:19:49 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-15 23:19:49 +0100
commit2be233ebe39d6ce584848a7e6bbd68b011dd6930 (patch)
treeca75915525e4414b57a8fdfaaf68175e990055cc
parent1e419cd31bea64c664c36dee10fa9e843b6f76d6 (diff)
parent51118b1974fd91d7f60ed1a68e1eb5717690362b (diff)
downloadsamba-2be233ebe39d6ce584848a7e6bbd68b011dd6930.tar.gz
samba-2be233ebe39d6ce584848a7e6bbd68b011dd6930.tar.bz2
samba-2be233ebe39d6ce584848a7e6bbd68b011dd6930.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/nsswitch/pam_winbind.c4
-rw-r--r--source3/param/loadparm.c94
-rw-r--r--source3/web/swat.c4
4 files changed, 79 insertions, 25 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6c6bba3a71..24929f6d7f 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4252,7 +4252,7 @@ const char *lp_ldap_machine_suffix(void);
const char *lp_ldap_user_suffix(void);
const char *lp_ldap_group_suffix(void);
const char *lp_ldap_idmap_suffix(void);
-void *lp_local_ptr(int snum, void *ptr);
+void *lp_local_ptr_by_snum(int snum, void *ptr);
bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
void init_locals(void);
bool lp_is_default(int snum, struct parm_struct *parm);
diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c
index be22ff3f5e..d049bdb1e7 100644
--- a/source3/nsswitch/pam_winbind.c
+++ b/source3/nsswitch/pam_winbind.c
@@ -93,8 +93,8 @@ static const char *_pam_error_code_str(int err)
return "PAM_CONV_ERR";
case PAM_AUTHTOK_ERR:
return "PAM_AUTHTOK_ERR";
- case PAM_AUTHTOK_RECOVERY_ERR:
- return "PAM_AUTHTOK_RECOVERY_ERR";
+ case PAM_AUTHTOK_RECOVER_ERR:
+ return "PAM_AUTHTOK_RECOVER_ERR";
case PAM_AUTHTOK_LOCK_BUSY:
return "PAM_AUTHTOK_LOCK_BUSY";
case PAM_AUTHTOK_DISABLE_AGING:
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 7e7a1e505e..9a55067b01 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -425,7 +425,7 @@ struct service {
bool bHideUnReadable;
bool bHideUnWriteableFiles;
bool bBrowseable;
- bool bAccessBasedShareEnum;
+ bool bAccessBasedShareEnum;
bool bAvailable;
bool bRead_only;
bool bNo_set_dir;
@@ -569,7 +569,7 @@ static struct service sDefault = {
False, /* bHideUnReadable */
False, /* bHideUnWriteableFiles */
True, /* bBrowseable */
- False, /* bAccessBasedShareEnum */
+ False, /* bAccessBasedShareEnum */
True, /* bAvailable */
True, /* bRead_only */
True, /* bNo_set_dir */
@@ -671,6 +671,8 @@ static void set_server_role(void);
static void set_default_server_announce_type(void);
static void set_allowed_client_auth(void);
+static void *lp_local_ptr(struct service *service, void *ptr);
+
static const struct enum_list enum_protocol[] = {
{PROTOCOL_NT1, "NT1"},
{PROTOCOL_LANMAN2, "LANMAN2"},
@@ -4584,9 +4586,56 @@ static void init_printer_values(struct service *pService)
}
/**
- * Free the allocated data for one parameter for a given share.
+ * Common part of freeing allocated data for one parameter.
+ */
+static void free_one_parameter_common(void *parm_ptr,
+ struct parm_struct parm)
+{
+ if ((parm.type == P_STRING) ||
+ (parm.type == P_USTRING))
+ {
+ string_free((char**)parm_ptr);
+ } else if (parm.type == P_LIST) {
+ TALLOC_FREE(*((char***)parm_ptr));
+ }
+}
+
+/**
+ * Free the allocated data for one parameter for a share
+ * given as a service struct.
*/
-static void free_parameter(int snum, struct parm_struct parm)
+static void free_one_parameter(struct service *service,
+ struct parm_struct parm)
+{
+ void *parm_ptr;
+
+ if (parm.p_class != P_LOCAL) {
+ return;
+ }
+
+ parm_ptr = lp_local_ptr(service, parm.ptr);
+
+ free_one_parameter_common(parm_ptr, parm);
+}
+
+/**
+ * Free the allocated parameter data of a share given
+ * as a service struct.
+ */
+static void free_parameters(struct service *service)
+{
+ uint32_t i;
+
+ for (i=0; parm_table[i].label; i++) {
+ free_one_parameter(service, parm_table[i]);
+ }
+}
+
+/**
+ * Free the allocated data for one parameter for a given share
+ * specified by an snum.
+ */
+static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
{
void *parm_ptr;
@@ -4599,27 +4648,22 @@ static void free_parameter(int snum, struct parm_struct parm)
} else if (parm.p_class != P_LOCAL) {
return;
} else {
- parm_ptr = lp_local_ptr(snum, parm.ptr);
+ parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
}
- if ((parm.type == P_STRING) ||
- (parm.type == P_USTRING))
- {
- string_free((char**)parm_ptr);
- } else if (parm.type == P_LIST) {
- TALLOC_FREE(*((char***)parm_ptr));
- }
+ free_one_parameter_common(parm_ptr, parm);
}
/**
- * Free the allocated parameter data for a share.
+ * Free the allocated parameter data for a share specified
+ * by an snum.
*/
-static void free_parameters(int snum)
+static void free_parameters_by_snum(int snum)
{
uint32_t i;
for (i=0; parm_table[i].label; i++) {
- free_parameter(snum, parm_table[i]);
+ free_one_parameter_by_snum(snum, parm_table[i]);
}
}
@@ -4628,7 +4672,7 @@ static void free_parameters(int snum)
*/
static void free_global_parameters(void)
{
- free_parameters(GLOBAL_SECTION_SNUM);
+ free_parameters_by_snum(GLOBAL_SECTION_SNUM);
}
/***************************************************************************
@@ -5739,7 +5783,7 @@ static void free_service(struct service *pservice)
DEBUG(5, ("free_service: Freeing service %s\n",
pservice->szService));
- free_parameters(getservicebyname(pservice->szService, NULL));
+ free_parameters(pservice);
string_free(&pservice->szService);
bitmap_free(pservice->copymap);
@@ -7167,13 +7211,23 @@ static void init_copymap(struct service *pservice)
}
/***************************************************************************
+ Return the local pointer to a parameter given a service struct and the
+ pointer into the default structure.
+***************************************************************************/
+
+static void *lp_local_ptr(struct service *service, void *ptr)
+{
+ return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
+}
+
+/***************************************************************************
Return the local pointer to a parameter given the service number and the
pointer into the default structure.
***************************************************************************/
-void *lp_local_ptr(int snum, void *ptr)
+void *lp_local_ptr_by_snum(int snum, void *ptr)
{
- return (void *)(((char *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault));
+ return lp_local_ptr(ServicePtrs[snum], ptr);
}
/***************************************************************************
@@ -7225,7 +7279,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
pszParmName));
return (True);
}
- parm_ptr = lp_local_ptr(snum, def_ptr);
+ parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
}
if (snum >= 0) {
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 27c4b54e2f..b729e3b241 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -232,7 +232,7 @@ static void show_parameter(int snum, struct parm_struct *parm)
TALLOC_CTX *ctx = talloc_stackframe();
if (parm->p_class == P_LOCAL && snum >= 0) {
- ptr = lp_local_ptr(snum, ptr);
+ ptr = lp_local_ptr_by_snum(snum, ptr);
}
printf("<tr><td>%s</td><td>", get_parm_translated(ctx,
@@ -375,7 +375,7 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte
void *ptr = parm->ptr;
if (parm->p_class == P_LOCAL && snum >= 0) {
- ptr = lp_local_ptr(snum, ptr);
+ ptr = lp_local_ptr_by_snum(snum, ptr);
}
switch (parm->type) {