param: turn 'cups encrypt' into a generated function
authorMichael Adam <obnox@samba.org>
Wed, 22 Jul 2015 14:22:40 +0000 (16:22 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 30 Jul 2015 23:55:30 +0000 (01:55 +0200)
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>
docs-xml/smbdotconf/printing/cupsencrypt.xml
lib/param/loadparm.c
lib/param/loadparm.h
source3/param/loadparm.c

index db7bf51fd5e6af4b5f58463b9315b872d9792cef..8094abe8f767cb5d255a27be4b85643444f9e138 100644 (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>
index 63c908ba728d1b8d2b19ce6eb36199a64c3d1985..1369c70f5882f4d394047ecdde1efe6966b98cc9 100644 (file)
 #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.
 ***************************************************************************/
index 81994392bd1ae4b873d1e00f023324de92c79e63..de92cb81f213bfe263f6e3b6a018fca19eb51dbf 100644 (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;
index 54a2406738221842e4a3889ee94dce31a0d7861c..4c9cd19ee6d7bec5b9a6bf405976b9f2d2d9b4e1 100644 (file)
 #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"