[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-587-g212ab58

Kai Blin kai at samba.org
Tue Dec 11 10:55:44 GMT 2007


The branch, v3-2-test has been updated
       via  212ab58a3a7f03bb97c6ad3430e2776f9faba7c9 (commit)
      from  3f6cc826378729c9157ea68e7cf5c7b584bbb585 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 212ab58a3a7f03bb97c6ad3430e2776f9faba7c9
Author: Kai Blin <kai at samba.org>
Date:   Mon Dec 10 22:30:24 2007 +0100

    vlp: Build vlp (virtual line printer) against current git on make
    everything.

-----------------------------------------------------------------------

Summary of changes:
 source/Makefile.in       |   16 ++++++++++++++-
 testsuite/printing/vlp.c |   47 +++++++++++++++++++++++++--------------------
 2 files changed, 41 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index e636a91..20dba0c 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -194,7 +194,8 @@ BIN_PROGS = @EXTRA_BIN_PROGS@ @SMBMOUNT_PROGS@ \
 
 EVERYTHING_PROGS = bin/debug2html at EXEEXT@ bin/smbfilter at EXEEXT@ \
 	bin/talloctort at EXEEXT@ bin/replacetort at EXEEXT@ \
-	bin/log2pcap at EXEEXT@ bin/sharesec at EXEEXT@ bin/ndrdump at EXEEXT@
+	bin/log2pcap at EXEEXT@ bin/sharesec at EXEEXT@ bin/ndrdump at EXEEXT@ \
+	bin/vlp at EXEEXT@
 
 SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@
 
@@ -955,6 +956,14 @@ NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \
 		$(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \
 		$(LDB_OBJ) $(ERRORMAP_OBJ)
 
+VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ)
+
+VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \
+	  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \
+	  $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \
+	  $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
+	  $(DISPLAY_SEC_OBJ)
+
 ######################################################################
 # now the rules...
 ######################################################################
@@ -1442,6 +1451,11 @@ bin/winbindd at EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@
 	@$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
 		@POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS)
 
+bin/vlp at EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ)
+	@echo "Linking $@"
+	@$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
+		$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
+
 @WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ)
 	@echo "Linking $@"
 	@$(SHLD) $(WINBIND_NSS_LDSHFLAGS) -o $@ $(WINBIND_NSS_OBJ) \
diff --git a/testsuite/printing/vlp.c b/testsuite/printing/vlp.c
index db78105..5c8dcd9 100644
--- a/testsuite/printing/vlp.c
+++ b/testsuite/printing/vlp.c
@@ -53,7 +53,7 @@ static void get_job_list(char *printer, struct vlp_job **job_list,
 	TDB_DATA data;
 
 	slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
-	data = tdb_fetch_by_string(tdb, keystr);
+	data = tdb_fetch_bystring(tdb, keystr);
 
 	*job_list = (struct vlp_job *)data.dptr;
 	*num_jobs = data.dsize / sizeof(struct vlp_job);
@@ -65,11 +65,13 @@ static void set_job_list(char *printer, struct vlp_job *job_list,
 			 int num_jobs)
 {
 	fstring keystr;
+	TDB_DATA data;
 
 	slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
 
-	tdb_store_by_string(tdb, keystr, job_list, 
-			    num_jobs * sizeof(struct vlp_job));
+	data.dptr = (unsigned char *)job_list;
+	data.dsize = num_jobs * sizeof(struct vlp_job);
+	tdb_store_bystring(tdb, keystr, data, TDB_REPLACE);
 }
 
 /* Return the next job number for a printer */
@@ -83,7 +85,7 @@ static int next_jobnum(char *printer)
 
 	tdb_lock_bystring(tdb, keystr);
 
-	jobnum = tdb_fetch_int(tdb, keystr);
+	jobnum = tdb_fetch_int32(tdb, keystr);
 
 	/* Create next job index if none exists */
 
@@ -92,7 +94,7 @@ static int next_jobnum(char *printer)
 	}
 
 	jobnum++;
-	tdb_store_int(tdb, keystr, jobnum);
+	tdb_store_int32(tdb, keystr, jobnum);
 
 	tdb_unlock_bystring(tdb, keystr);
 
@@ -105,7 +107,7 @@ static void set_printer_status(char *printer, int status)
 	int result;
 
 	slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer);
-	result = tdb_store_int(tdb, keystr, status);
+	result = tdb_store_int32(tdb, keystr, status);
 }
 
 static int get_printer_status(char *printer)
@@ -115,7 +117,7 @@ static int get_printer_status(char *printer)
 
 	slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer);
 
-	data.dptr = keystr;
+	data.dptr = (unsigned char *)keystr;
 	data.dsize = strlen(keystr) + 1;
 
 	if (!tdb_exists(tdb, data)) {
@@ -123,7 +125,7 @@ static int get_printer_status(char *printer)
 		return LPSTAT_OK;
 	}
 
-	return tdb_fetch_int(tdb, keystr);
+	return tdb_fetch_int32(tdb, keystr);
 }
 
 /* Display printer queue */
@@ -212,7 +214,7 @@ static int print_command(int argc, char **argv)
 	char *printer;
 	fstring keystr;
 	struct passwd *pw;
-	TDB_DATA value;
+	TDB_DATA value, queue;
 	struct vlp_job job;
 	int i;
 
@@ -247,30 +249,33 @@ static int print_command(int argc, char **argv)
 	/* Store job entry in queue */
 
 	slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
-	
-	value = tdb_fetch_by_string(tdb, keystr);
+
+	value = tdb_fetch_bystring(tdb, keystr);
 
 	if (value.dptr) {
 
 		/* Add job to end of queue */
 
-		value.dptr = realloc(value.dptr, value.dsize + 
-				     sizeof(struct vlp_job));
-		if (!value.dptr) return 1;
+		queue.dptr = SMB_MALLOC(value.dsize + sizeof(struct vlp_job));
+		if (!queue.dptr) return 1;
+
+		memcpy(queue.dptr, value.dptr, value.dsize);
+		memcpy(queue.dptr + value.dsize, &job, sizeof(struct vlp_job));
 
-		memcpy(value.dptr + value.dsize, &job, sizeof(struct vlp_job));
+		queue.dsize = value.dsize + sizeof(struct vlp_job);
 
-		tdb_store_by_string(tdb, keystr, value.dptr, value.dsize +
-				    sizeof(struct vlp_job));
+		tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE);
 
-		free(value.dptr);
+		free(queue.dptr);
 
 	} else {
-		
+
 		/* Create new queue */
+		queue.dptr = (unsigned char *)&job;
+		queue.dsize = sizeof(struct vlp_job);
 
-		tdb_store_by_string(tdb, keystr, &job, sizeof(struct vlp_job));
-	}		
+		tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE);
+	}
 
 	return 0;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list