[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Jan 17 12:37:02 MST 2013


The branch, master has been updated
       via  d34cd6d printing: Create default architecture directories on init.
      from  79fa78e s3-spoolss: use configurable spoolss architecture in compose_spoolss_server_path().

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d34cd6d061ce53c305e146420c4b4451fe35df6f
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Jan 17 17:18:04 2013 +0100

    printing: Create default architecture directories on init.
    
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Jan 17 20:36:17 CET 2013 on sn-devel-104

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

Summary of changes:
 source3/printing/nt_printing.c |   59 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index e09ee89..7bf2c55 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -74,6 +74,61 @@ static const struct print_architecture_table_node archi_table[]= {
 	{NULL,                   "",		-1 }
 };
 
+static bool print_driver_directories_init(void)
+{
+	int service, i;
+	char *driver_path;
+	bool ok;
+	TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+	service = lp_servicenumber("print$");
+	if (service < 0) {
+		/* We don't have a print$ share */
+		DEBUG(5, ("No print$ share has been configured.\n"));
+		return true;
+	}
+
+	driver_path = lp_pathname(mem_ctx, service);
+	if (driver_path == NULL) {
+		return false;
+	}
+
+	ok = directory_create_or_exist(driver_path, sec_initial_uid(), 0755);
+	if (!ok) {
+		DEBUG(1, ("Failed to create printer driver directory %s\n",
+			  driver_path));
+		talloc_free(mem_ctx);
+		return false;
+	}
+
+	for (i = 0; archi_table[i].long_archi != NULL; i++) {
+		const char *arch_path;
+
+		arch_path = talloc_asprintf(mem_ctx,
+					    "%s/%s",
+					    driver_path,
+					    archi_table[i].short_archi);
+		if (arch_path == NULL) {
+			talloc_free(mem_ctx);
+			return false;
+		}
+
+		ok = directory_create_or_exist(arch_path,
+					       sec_initial_uid(),
+					       0755);
+		if (!ok) {
+			DEBUG(1, ("Failed to create printer driver "
+				  "architecture directory %s\n",
+				  arch_path));
+			talloc_free(mem_ctx);
+			return false;
+		}
+	}
+
+	talloc_free(mem_ctx);
+	return true;
+}
+
 /****************************************************************************
  Open the NT printing tdbs. Done once before fork().
 ****************************************************************************/
@@ -82,6 +137,10 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
 {
 	WERROR win_rc;
 
+	if (!print_driver_directories_init()) {
+		return false;
+	}
+
 	if (!nt_printing_tdb_upgrade()) {
 		return false;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list