svn commit: samba r5514 - in trunk/source: . param printing

gd at samba.org gd at samba.org
Wed Feb 23 10:20:14 GMT 2005


Author: gd
Date: 2005-02-23 10:20:13 +0000 (Wed, 23 Feb 2005)
New Revision: 5514

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5514

Log:
Build (but dont use yet) the ldap printer-backend functions.

Guenther

Modified:
   trunk/source/Makefile.in
   trunk/source/param/loadparm.c
   trunk/source/printing/nt_printing.c
   trunk/source/printing/ntprint_ldap.c


Changeset:
Modified: trunk/source/Makefile.in
===================================================================
--- trunk/source/Makefile.in	2005-02-23 02:20:54 UTC (rev 5513)
+++ trunk/source/Makefile.in	2005-02-23 10:20:13 UTC (rev 5514)
@@ -415,7 +415,7 @@
 
 PRINTBASE_OBJ = printing/notify.o printing/printing_db.o
 
-PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ)
+PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ) printing/ntprint_ldap.o
 
 SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN)
 NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \

Modified: trunk/source/param/loadparm.c
===================================================================
--- trunk/source/param/loadparm.c	2005-02-23 02:20:54 UTC (rev 5513)
+++ trunk/source/param/loadparm.c	2005-02-23 10:20:13 UTC (rev 5514)
@@ -227,6 +227,7 @@
 	char *szLdapUserSuffix;
 	char *szLdapIdmapSuffix;
 	char *szLdapGroupSuffix;
+	char *szLdapPrinterSuffix;
 #ifdef WITH_LDAP_SAMCONFIG
 	int ldap_port;
 	char *szLdapServer;
@@ -1099,6 +1100,7 @@
 	{"ldap group suffix", P_STRING, P_GLOBAL, &Globals.szLdapGroupSuffix, NULL, NULL, FLAG_ADVANCED}, 
 	{"ldap idmap suffix", P_STRING, P_GLOBAL, &Globals.szLdapIdmapSuffix, NULL, NULL, FLAG_ADVANCED}, 
 	{"ldap machine suffix", P_STRING, P_GLOBAL, &Globals.szLdapMachineSuffix, NULL, NULL, FLAG_ADVANCED}, 
+	{"ldap printer suffix", P_STRING, P_GLOBAL, &Globals.szLdapPrinterSuffix, NULL, NULL, FLAG_ADVANCED}, 
 	{"ldap passwd sync", P_ENUM, P_GLOBAL, &Globals.ldap_passwd_sync, NULL, enum_ldap_passwd_sync, FLAG_ADVANCED}, 
 	{"ldap password sync", P_ENUM, P_GLOBAL, &Globals.ldap_passwd_sync, NULL, enum_ldap_passwd_sync, FLAG_HIDE}, 
 	{"ldap replication sleep", P_INTEGER, P_GLOBAL, &Globals.ldap_replication_sleep, NULL, NULL, FLAG_ADVANCED},
@@ -1484,6 +1486,7 @@
 	string_set(&Globals.szLdapUserSuffix, "");
 	string_set(&Globals.szLdapGroupSuffix, "");
 	string_set(&Globals.szLdapIdmapSuffix, "");
+	string_set(&Globals.szLdapPrinterSuffix, "");
 
 	string_set(&Globals.szLdapAdminDn, "");
 	Globals.ldap_ssl = LDAP_SSL_ON;
@@ -3010,6 +3013,15 @@
 	return lp_string(Globals.szLdapSuffix);
 }
 
+char *lp_ldap_printer_suffix(void)
+{
+	if (Globals.szLdapPrinterSuffix[0])
+		return append_ldap_suffix(Globals.szLdapPrinterSuffix);
+
+	return lp_string(Globals.szLdapSuffix);
+}
+
+
 /***************************************************************************
 ***************************************************************************/
 

Modified: trunk/source/printing/nt_printing.c
===================================================================
--- trunk/source/printing/nt_printing.c	2005-02-23 02:20:54 UTC (rev 5513)
+++ trunk/source/printing/nt_printing.c	2005-02-23 10:20:13 UTC (rev 5514)
@@ -2401,7 +2401,7 @@
  Allocate and initialize a new slot.
 ***************************************************************************/
  
-static int add_new_printer_key( NT_PRINTER_DATA *data, const char *name )
+int add_new_printer_key( NT_PRINTER_DATA *data, const char *name )
 {
 	NT_PRINTER_KEY	*d;
 	int		key_index;

Modified: trunk/source/printing/ntprint_ldap.c
===================================================================
--- trunk/source/printing/ntprint_ldap.c	2005-02-23 02:20:54 UTC (rev 5513)
+++ trunk/source/printing/ntprint_ldap.c	2005-02-23 10:20:13 UTC (rev 5514)
@@ -19,6 +19,7 @@
  */
 
 #include "includes.h"
+#ifdef HAVE_LDAP
 
 struct prldap_state {
 	BOOL initialized;
@@ -92,12 +93,16 @@
        (*(num)) += 1; } \
 } while (0)
 
+/* already defined in include/ldap_smb.h */
+#if 0 
 struct ldap_attribute {
 	const char *name;
 	int num_values;
 	DATA_BLOB *values;
 };
+#endif
 
+
 struct ldap_entry {
 	TALLOC_CTX *mem_ctx;
 	BOOL has_error;
@@ -111,17 +116,17 @@
 static char *ldaperr(LDAP *ld)
 {
 	static fstring error;
-	char *ldap_error = NULL;
-	if (ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ldap_error) != 0) {
+	char *ldap_error_str = NULL;
+	if (ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ldap_error_str) != 0) {
 		fstrcpy(error, "ldap_get_option failed");
 		return error;
 	}
-	if (ldap_error == NULL) {
+	if (ldap_error_str == NULL) {
 		fstrcpy(error, "no ldap_error");
 		return error;
 	}
-	fstrcpy(error, ldap_error);
-	ldap_memfree(ldap_error);
+	fstrcpy(error, ldap_error_str);
+	ldap_memfree(ldap_error_str);
 	return error;
 }
 
@@ -773,7 +778,7 @@
 					"(&(objectclass=sambaPrinter)"
 					"(sambaPrintName=%s))", name);
 	entry->suffix =	talloc_strdup(entry->mem_ctx,
-				      lp_ldap_printer_suffix());
+				      (const char *)lp_ldap_printer_suffix());
 
 	return entry;
 }
@@ -803,13 +808,14 @@
 			/* pathname should be stored as <key>\<value> */
 			
 			val = regval_ctr_specific_value( val_ctr, j );
-
+#if 0
 			ldapval = data_blob_pack("PPdB",
 						 data->keys[i].name,
 						 regval_name(val),
 						 regval_type(val),
 						 regval_size(val),
 						 regval_data_p(val) );
+#endif
 
 			ldap_entry_bin(entry, "sambaPrintData",
 				       ldapval.data, ldapval.length);
@@ -818,6 +824,7 @@
 		}
 	
 	}
+
 }
 
 BOOL prldap_set_printer(NT_PRINTER_INFO_LEVEL_2 *printer)
@@ -1019,14 +1026,14 @@
 
 	entry->dn = talloc_asprintf(entry->mem_ctx,
 				    "sambaFormName=%s,cn=Forms,%s",
-				    name, lp_ldap_printer_suffix());
+				    name, (const char *)lp_ldap_printer_suffix());
 
 	entry->filter = talloc_asprintf(entry->mem_ctx,
 					"(&(objectClass=sambaPrinterForm)"
 					"(sambaFormName=%s))", name);
 
 	entry->suffix = talloc_strdup(entry->mem_ctx,
-				      lp_ldap_printer_suffix());
+				      (const char *)lp_ldap_printer_suffix());
 
 	return entry;
 }
@@ -1116,7 +1123,7 @@
 	entry->dn = talloc_asprintf(entry->mem_ctx,
 				    "sambaDrvName=%s,cn=%d,cn=%s,"
 				    "cn=Drivers,%s", name, cversion,
-				    architecture, lp_ldap_printer_suffix());
+				    architecture, (const char *)lp_ldap_printer_suffix());
 
 	entry->filter = talloc_asprintf(entry->mem_ctx,
 					"(&(objectClass=sambaPrinterDriver)"
@@ -1126,7 +1133,7 @@
 					name, cversion, architecture);
 
 	entry->suffix = talloc_strdup(entry->mem_ctx,
-				      lp_ldap_printer_suffix());
+				      (const char *)lp_ldap_printer_suffix());
 
 
 	return entry;
@@ -1227,3 +1234,4 @@
 
 	return driver;
 }
+#endif



More information about the samba-cvs mailing list