/* prototypes for the special type handlers */
static bool handle_include(struct loadparm_context *lp_ctx, int unused,
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"
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)
{
bool bRetval;
- struct loadparm_service *serviceTemp;
-
- lpcfg_string_set(lp_ctx, ptr, pszParmValue);
+ struct loadparm_service *serviceTemp = NULL;
+ struct loadparm_service *current = NULL;
bRetval = false;
DEBUG(3, ("Copying service from service %s\n", 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 == lp_ctx->currentService) {
+ if (serviceTemp == current) {
DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
} else {
- copy_service(lp_ctx->currentService,
+ copy_service(current,
serviceTemp,
- lp_ctx->currentService->copymap);
+ current->copymap);
+ lpcfg_string_set(current, ptr, pszParmValue);
+
bRetval = true;
}
} else {
/* prototypes for the special type handlers */
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_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);
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)
{
Globals.ldap_debug_level = lp_int(pszParmValue);