mirror of
https://github.com/samba-team/samba.git
synced 2025-02-09 09:57:48 +03:00
param: consolidate handle_copy method between the two loadparms
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
c3c8f4fe9c
commit
ef3d445d88
@ -98,8 +98,6 @@ static bool defaults_saved = false;
|
|||||||
/* prototypes for the special type handlers */
|
/* prototypes for the special type handlers */
|
||||||
static bool handle_include(struct loadparm_context *lp_ctx, int unused,
|
static bool handle_include(struct loadparm_context *lp_ctx, int unused,
|
||||||
const char *pszParmValue, char **ptr);
|
const char *pszParmValue, char **ptr);
|
||||||
static bool handle_copy(struct loadparm_context *lp_ctx, int unused,
|
|
||||||
const char *pszParmValue, char **ptr);
|
|
||||||
|
|
||||||
#include "lib/param/param_table.c"
|
#include "lib/param/param_table.c"
|
||||||
|
|
||||||
@ -1133,27 +1131,38 @@ static bool handle_include(struct loadparm_context *lp_ctx, int unused,
|
|||||||
Handle the interpretation of the copy parameter.
|
Handle the interpretation of the copy parameter.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static bool handle_copy(struct loadparm_context *lp_ctx, int unused,
|
bool handle_copy(struct loadparm_context *lp_ctx, int snum,
|
||||||
const char *pszParmValue, char **ptr)
|
const char *pszParmValue, char **ptr)
|
||||||
{
|
{
|
||||||
bool bRetval;
|
bool bRetval;
|
||||||
struct loadparm_service *serviceTemp;
|
struct loadparm_service *serviceTemp = NULL;
|
||||||
|
struct loadparm_service *current = NULL;
|
||||||
lpcfg_string_set(lp_ctx, ptr, pszParmValue);
|
|
||||||
|
|
||||||
bRetval = false;
|
bRetval = false;
|
||||||
|
|
||||||
DEBUG(3, ("Copying service from service %s\n", pszParmValue));
|
DEBUG(3, ("Copying service from service %s\n", pszParmValue));
|
||||||
|
|
||||||
serviceTemp = lpcfg_getservicebyname(lp_ctx, pszParmValue);
|
serviceTemp = lpcfg_getservicebyname(lp_ctx, pszParmValue);
|
||||||
|
if (lp_ctx->s3_fns != NULL) {
|
||||||
|
current = lp_ctx->s3_fns->get_servicebynum(snum);
|
||||||
|
} else {
|
||||||
|
current = lp_ctx->currentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current == NULL) {
|
||||||
|
DEBUG(0, ("Unable to copy service - invalid service destination"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (serviceTemp != NULL) {
|
if (serviceTemp != NULL) {
|
||||||
if (serviceTemp == lp_ctx->currentService) {
|
if (serviceTemp == current) {
|
||||||
DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
|
DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
|
||||||
} else {
|
} else {
|
||||||
copy_service(lp_ctx->currentService,
|
copy_service(current,
|
||||||
serviceTemp,
|
serviceTemp,
|
||||||
lp_ctx->currentService->copymap);
|
current->copymap);
|
||||||
|
lpcfg_string_set(current, ptr, pszParmValue);
|
||||||
|
|
||||||
bRetval = true;
|
bRetval = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,7 +261,6 @@ static bool bGlobalOnly = false;
|
|||||||
|
|
||||||
/* prototypes for the special type handlers */
|
/* prototypes for the special type handlers */
|
||||||
static bool handle_include(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
static bool handle_include(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
||||||
static bool handle_copy(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
|
||||||
static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
||||||
static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
||||||
static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
|
||||||
@ -2627,37 +2626,6 @@ static bool handle_include(struct loadparm_context *unused, int snum, const char
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
Handle the interpretation of the copy parameter.
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
static bool handle_copy(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
|
|
||||||
{
|
|
||||||
bool bRetval;
|
|
||||||
int iTemp;
|
|
||||||
|
|
||||||
bRetval = false;
|
|
||||||
|
|
||||||
DEBUG(3, ("Copying service from service %s\n", pszParmValue));
|
|
||||||
|
|
||||||
if ((iTemp = getservicebyname(pszParmValue, NULL)) >= 0) {
|
|
||||||
if (iTemp == snum) {
|
|
||||||
DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
|
|
||||||
} else {
|
|
||||||
copy_service(ServicePtrs[snum],
|
|
||||||
serviceTemp,
|
|
||||||
ServicePtrs[snum]->copymap);
|
|
||||||
string_set(ServicePtrs[snum], ptr, pszParmValue);
|
|
||||||
bRetval = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
|
|
||||||
bRetval = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (bRetval);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
|
static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
|
||||||
{
|
{
|
||||||
Globals.ldap_debug_level = lp_int(pszParmValue);
|
Globals.ldap_debug_level = lp_int(pszParmValue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user