From 4ae289c27127c2af1f77108863862990419ff7f8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 22 Jul 2015 16:22:40 +0200 Subject: [PATCH] param: turn 'cups encrypt' into a generated function Move the special stuff of the hand-written lp_cups_encrypt() function into a handler that is called once at load time. Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison --- docs-xml/smbdotconf/printing/cupsencrypt.xml | 1 - lib/param/loadparm.c | 32 ++++++++++++++++++++++++++++ lib/param/loadparm.h | 1 - source3/param/loadparm.c | 23 -------------------- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/docs-xml/smbdotconf/printing/cupsencrypt.xml b/docs-xml/smbdotconf/printing/cupsencrypt.xml index db7bf51fd5e..8094abe8f76 100644 --- a/docs-xml/smbdotconf/printing/cupsencrypt.xml +++ b/docs-xml/smbdotconf/printing/cupsencrypt.xml @@ -2,7 +2,6 @@ context="G" type="enum" enumlist="enum_bool_auto" - generated_function="0" xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 63c908ba728..1369c70f588 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -69,6 +69,10 @@ #include "tdb.h" #include "librpc/gen_ndr/nbt.h" +#ifdef HAVE_HTTPCONNECTENCRYPT +#include +#endif + #define standard_sub_basic talloc_strdup #include "lib/param/param_global.h" @@ -1381,6 +1385,34 @@ bool handle_smb2_max_credits(struct loadparm_context *lp_ctx, return true; } +bool handle_cups_encrypt(struct loadparm_context *lp_ctx, + struct loadparm_service *service, + const char *pszParmValue, char **ptr) +{ + int result = 0; +#ifdef HAVE_HTTPCONNECTENCRYPT + int value = lp_int(pszParmValue); + + switch (value) { + case Auto: + result = HTTP_ENCRYPT_REQUIRED; + break; + case true: + result = HTTP_ENCRYPT_ALWAYS; + break; + case false: + result = HTTP_ENCRYPT_NEVER; + break; + default: + result = 0; + break; + } +#endif + *(int *)ptr = result; + + return true; +} + /*************************************************************************** Initialise a copymap. ***************************************************************************/ diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h index 81994392bd1..de92cb81f21 100644 --- a/lib/param/loadparm.h +++ b/lib/param/loadparm.h @@ -248,7 +248,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; #define LOADPARM_EXTRA_GLOBALS \ struct parmlist_entry *param_opt; \ char *realm_original; \ - int cups_encrypt; \ char *szIdmapUID; \ char *szIdmapGID; \ char *szIdmapBackend; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 54a24067382..4c9cd19ee6d 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -75,10 +75,6 @@ #include #endif -#ifdef HAVE_HTTPCONNECTENCRYPT -#include -#endif - bool bLoaded = false; extern userdom_struct current_user_info; @@ -1030,25 +1026,6 @@ int lp_winbind_max_domain_connections(void) return MAX(1, lp__winbind_max_domain_connections()); } -int lp_cups_encrypt(void) -{ - int result = 0; -#ifdef HAVE_HTTPCONNECTENCRYPT - switch (Globals.cups_encrypt) { - case Auto: - result = HTTP_ENCRYPT_REQUIRED; - break; - case true: - result = HTTP_ENCRYPT_ALWAYS; - break; - case false: - result = HTTP_ENCRYPT_NEVER; - break; - } -#endif - return result; -} - /* These functions remain in source3/param for now */ #include "lib/param/param_functions.c" -- 2.11.4.GIT