1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Merge branch 'master' of ssh://git.samba.org/data/git/samba

This commit is contained in:
Jelmer Vernooij 2008-12-15 23:19:49 +01:00
commit 2be233ebe3
4 changed files with 79 additions and 25 deletions

View File

@ -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);

View File

@ -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:

View File

@ -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_parameter(int snum, struct parm_struct parm)
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_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);
@ -7166,14 +7210,24 @@ static void init_copymap(struct service *pservice)
bitmap_set(pservice->copymap, i);
}
/***************************************************************************
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) {

View File

@ -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) {