1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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 <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Michael Adam 2015-07-22 16:22:40 +02:00 committed by Jeremy Allison
parent 5c18d00135
commit 4ae289c271
4 changed files with 32 additions and 25 deletions

View File

@ -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">
<description>
<para>

View File

@ -69,6 +69,10 @@
#include "tdb.h"
#include "librpc/gen_ndr/nbt.h"
#ifdef HAVE_HTTPCONNECTENCRYPT
#include <cups/http.h>
#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.
***************************************************************************/

View File

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

View File

@ -75,10 +75,6 @@
#include <sys/sysctl.h>
#endif
#ifdef HAVE_HTTPCONNECTENCRYPT
#include <cups/http.h>
#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"