[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-654-gdfa5591
Günther Deschner
gd at samba.org
Mon Feb 9 11:43:03 GMT 2009
The branch, master has been updated
via dfa559145c0cbee1f2acdf2c401125e75ca52922 (commit)
from 5bc97e0cf2fade9e0ff37a67a6256a4e94470f00 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit dfa559145c0cbee1f2acdf2c401125e75ca52922
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 9 12:40:12 2009 +0100
s3-spoolss: remove whitespace in printing code.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source3/printing/nt_printing.c | 644 +++++++++++++++++-----------------
source3/rpc_server/srv_spoolss_nt.c | 2 +-
source3/rpcclient/cmd_spoolss.c | 378 ++++++++++----------
3 files changed, 512 insertions(+), 512 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 0ed32d9..ad3a958 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -31,7 +31,7 @@ static TDB_CONTEXT *tdb_printers; /* used for printers files */
#define PRINTERS_PREFIX "PRINTERS/"
#define SECDESC_PREFIX "SECDESC/"
#define GLOBAL_C_SETPRINTER "GLOBALS/c_setprinter"
-
+
#define NTDRIVERS_DATABASE_VERSION_1 1
#define NTDRIVERS_DATABASE_VERSION_2 2
#define NTDRIVERS_DATABASE_VERSION_3 3 /* little endian version of v2 */
@@ -209,7 +209,7 @@ struct table_node {
const char *short_archi;
int version;
};
-
+
#define SPL_ARCH_WIN40 "WIN40"
#define SPL_ARCH_W32X86 "W32X86"
#define SPL_ARCH_W32MIPS "W32MIPS"
@@ -276,9 +276,9 @@ static TDB_DATA make_printers_secdesc_tdbkey(TALLOC_CTX *ctx,
static bool upgrade_to_version_3(void)
{
TDB_DATA kbuf, newkey, dbuf;
-
+
DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n"));
-
+
for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr;
newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
@@ -297,7 +297,7 @@ static bool upgrade_to_version_3(void)
return False;
}
}
-
+
if (strncmp((const char *)kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
DEBUG(0,("upgrade_to_version_3:moving printer\n"));
if (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) != 0) {
@@ -311,7 +311,7 @@ static bool upgrade_to_version_3(void)
return False;
}
}
-
+
if (strncmp((const char *)kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
DEBUG(0,("upgrade_to_version_3:moving secdesc\n"));
if (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) != 0) {
@@ -325,7 +325,7 @@ static bool upgrade_to_version_3(void)
return False;
}
}
-
+
SAFE_FREE(dbuf.dptr);
}
@@ -333,10 +333,10 @@ static bool upgrade_to_version_3(void)
}
/*******************************************************************
- Fix an issue with security descriptors. Printer sec_desc must
- use more than the generic bits that were previously used
+ Fix an issue with security descriptors. Printer sec_desc must
+ use more than the generic bits that were previously used
in <= 3.0.14a. They must also have a owner and group SID assigned.
- Otherwise, any printers than have been migrated to a Windows
+ Otherwise, any printers than have been migrated to a Windows
host using printmig.exe will not be accessible.
*******************************************************************/
@@ -381,29 +381,29 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
return 0;
}
sec = sd_orig->sd;
-
+
/* is this even valid? */
-
+
if ( !sec->dacl ) {
prs_mem_free( &ps );
return 0;
}
-
+
/* update access masks */
-
+
for ( i=0; i<sec->dacl->num_aces; i++ ) {
switch ( sec->dacl->aces[i].access_mask ) {
case (GENERIC_READ_ACCESS | GENERIC_WRITE_ACCESS | GENERIC_EXECUTE_ACCESS):
sec->dacl->aces[i].access_mask = PRINTER_ACE_PRINT;
break;
-
+
case GENERIC_ALL_ACCESS:
sec->dacl->aces[i].access_mask = PRINTER_ACE_FULL_CONTROL;
break;
-
+
case READ_CONTROL_ACCESS:
sec->dacl->aces[i].access_mask = PRINTER_ACE_MANAGE_DOCUMENTS;
-
+
default: /* no change */
break;
}
@@ -430,11 +430,11 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
prs_mem_free( &ps );
return 0;
}
-
+
prs_mem_free( &ps );
/* store it back */
-
+
sd_size = ndr_size_security_descriptor(sd_store->sd, NULL, 0)
+ sizeof(SEC_DESC_BUF);
if ( !prs_init(&ps, sd_size, ctx, MARSHALL) ) {
@@ -450,11 +450,11 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
data.dptr = (uint8 *)prs_data_p( &ps );
data.dsize = sd_size;
-
+
result = tdb_store( tdb_printers, key, data, TDB_REPLACE );
prs_mem_free( &ps );
-
+
/* 0 to continue and non-zero to stop traversal */
return (result == -1);
@@ -470,7 +470,7 @@ static bool upgrade_to_version_4(void)
DEBUG(0,("upgrade_to_version_4: upgrading printer security descriptors\n"));
- if ( !(ctx = talloc_init( "upgrade_to_version_4" )) )
+ if ( !(ctx = talloc_init( "upgrade_to_version_4" )) )
return False;
result = tdb_traverse( tdb_printers, sec_desc_upg_fn, ctx );
@@ -481,10 +481,10 @@ static bool upgrade_to_version_4(void)
}
/*******************************************************************
- Fix an issue with security descriptors. Printer sec_desc must
- use more than the generic bits that were previously used
+ Fix an issue with security descriptors. Printer sec_desc must
+ use more than the generic bits that were previously used
in <= 3.0.14a. They must also have a owner and group SID assigned.
- Otherwise, any printers than have been migrated to a Windows
+ Otherwise, any printers than have been migrated to a Windows
host using printmig.exe will not be accessible.
*******************************************************************/
@@ -513,7 +513,7 @@ static int normalize_printers_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
/* delete the original record and store under the normalized key */
if ( tdb_delete( the_tdb, key ) != 0 ) {
- DEBUG(0,("normalize_printers_fn: tdb_delete for [%s] failed!\n",
+ DEBUG(0,("normalize_printers_fn: tdb_delete for [%s] failed!\n",
key.dptr));
return 1;
}
@@ -537,7 +537,7 @@ static bool upgrade_to_version_5(void)
DEBUG(0,("upgrade_to_version_5: normalizing printer keys\n"));
- if ( !(ctx = talloc_init( "upgrade_to_version_5" )) )
+ if ( !(ctx = talloc_init( "upgrade_to_version_5" )) )
return False;
result = tdb_traverse( tdb_printers, normalize_printers_fn, NULL );
@@ -559,7 +559,7 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
if ( tdb_drivers && tdb_printers && tdb_forms )
return True;
-
+
if (tdb_drivers)
tdb_close(tdb_drivers);
tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
@@ -568,7 +568,7 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
state_path("ntdrivers.tdb"), strerror(errno) ));
return False;
}
-
+
if (tdb_printers)
tdb_close(tdb_printers);
tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
@@ -577,7 +577,7 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
state_path("ntprinters.tdb"), strerror(errno) ));
return False;
}
-
+
if (tdb_forms)
tdb_close(tdb_forms);
tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
@@ -586,9 +586,9 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
state_path("ntforms.tdb"), strerror(errno) ));
return False;
}
-
+
/* handle a Samba upgrade */
-
+
vers_id = tdb_fetch_int32(tdb_drivers, vstring);
if (vers_id == -1) {
DEBUG(10, ("Fresh database\n"));
@@ -598,13 +598,13 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
if ( vers_id != NTDRIVERS_DATABASE_VERSION_5 ) {
- if ((vers_id == NTDRIVERS_DATABASE_VERSION_1) || (IREV(vers_id) == NTDRIVERS_DATABASE_VERSION_1)) {
+ if ((vers_id == NTDRIVERS_DATABASE_VERSION_1) || (IREV(vers_id) == NTDRIVERS_DATABASE_VERSION_1)) {
if (!upgrade_to_version_3())
return False;
tdb_store_int32(tdb_drivers, vstring, NTDRIVERS_DATABASE_VERSION_3);
vers_id = NTDRIVERS_DATABASE_VERSION_3;
- }
-
+ }
+
if ((vers_id == NTDRIVERS_DATABASE_VERSION_2) || (IREV(vers_id) == NTDRIVERS_DATABASE_VERSION_2)) {
/* Written on a bigendian machine with old fetch_int code. Save as le. */
/* The only upgrade between V2 and V3 is to save the version in little-endian. */
@@ -632,7 +632,7 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
return False;
}
}
-
+
update_c_setprinter(True);
/*
@@ -652,7 +652,7 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
reset_all_printerdata);
/* of course, none of the message callbacks matter if you don't
- tell messages.c that you interested in receiving PRINT_GENERAL
+ tell messages.c that you interested in receiving PRINT_GENERAL
msgs. This is done in claim_connection() */
@@ -698,15 +698,15 @@ static int traverse_counting_printers(TDB_CONTEXT *t, TDB_DATA key,
TDB_DATA data, void *context)
{
int *printer_count = (int*)context;
-
+
if (memcmp(PRINTERS_PREFIX, key.dptr, sizeof(PRINTERS_PREFIX)-1) == 0) {
(*printer_count)++;
DEBUG(10,("traverse_counting_printers: printer = [%s] printer_count = %d\n", key.dptr, *printer_count));
}
-
+
return 0;
}
-
+
/*******************************************************************
Update the spooler global c_setprinter. This variable is initialized
when the parent smbd starts with the number of existing printers. It
@@ -718,12 +718,12 @@ uint32 update_c_setprinter(bool initialize)
{
int32 c_setprinter;
int32 printer_count = 0;
-
+
tdb_lock_bystring(tdb_printers, GLOBAL_C_SETPRINTER);
-
+
/* Traverse the tdb, counting the printers */
tdb_traverse(tdb_printers, traverse_counting_printers, (void *)&printer_count);
-
+
/* If initializing, set c_setprinter to current printers count
* otherwise, bump it by the current printer count
*/
@@ -731,12 +731,12 @@ uint32 update_c_setprinter(bool initialize)
c_setprinter = tdb_fetch_int32(tdb_printers, GLOBAL_C_SETPRINTER) + printer_count;
else
c_setprinter = printer_count;
-
+
DEBUG(10,("update_c_setprinter: c_setprinter = %u\n", (unsigned int)c_setprinter));
tdb_store_int32(tdb_printers, GLOBAL_C_SETPRINTER, c_setprinter);
-
+
tdb_unlock_bystring(tdb_printers, GLOBAL_C_SETPRINTER);
-
+
return (uint32)c_setprinter;
}
@@ -747,12 +747,12 @@ uint32 update_c_setprinter(bool initialize)
uint32 get_c_setprinter(void)
{
int32 c_setprinter = tdb_fetch_int32(tdb_printers, GLOBAL_C_SETPRINTER);
-
+
if (c_setprinter == (int32)-1)
c_setprinter = update_c_setprinter(True);
-
+
DEBUG(10,("get_c_setprinter: c_setprinter = %d\n", c_setprinter));
-
+
return (uint32)c_setprinter;
}
@@ -812,13 +812,13 @@ int get_ntforms(nt_forms_struct **list)
for (kbuf = tdb_firstkey(tdb_forms);
kbuf.dptr;
- newkey = tdb_nextkey(tdb_forms, kbuf), free(kbuf.dptr), kbuf=newkey)
+ newkey = tdb_nextkey(tdb_forms, kbuf), free(kbuf.dptr), kbuf=newkey)
{
- if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
+ if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
continue;
-
+
dbuf = tdb_fetch(tdb_forms, kbuf);
- if (!dbuf.dptr)
+ if (!dbuf.dptr)
continue;
fstrcpy(form.name, (const char *)kbuf.dptr+strlen(FORMS_PREFIX));
@@ -826,7 +826,7 @@ int get_ntforms(nt_forms_struct **list)
&i, &form.flag, &form.width, &form.length, &form.left,
&form.top, &form.right, &form.bottom);
SAFE_FREE(dbuf.dptr);
- if (ret != dbuf.dsize)
+ if (ret != dbuf.dsize)
continue;
*list = SMB_REALLOC_ARRAY(*list, nt_forms_struct, n+1);
@@ -837,7 +837,7 @@ int get_ntforms(nt_forms_struct **list)
(*list)[n] = form;
n++;
}
-
+
return n;
}
@@ -930,7 +930,7 @@ bool add_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int *
(*list)[n].right = form->area.right;
(*list)[n].bottom = form->area.bottom;
- DEBUG(6,("add_a_form: Successfully %s form [%s]\n",
+ DEBUG(6,("add_a_form: Successfully %s form [%s]\n",
update ? "updated" : "added", form->form_name));
return True;
@@ -1583,9 +1583,9 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
/*
* This is a Microsoft'ism. See references in MSDN to VER_FILEVERSION
- * for more details. Version in this case is not just the version of the
+ * for more details. Version in this case is not just the version of the
* file, but the version in the sense of kernal mode (2) vs. user mode
- * (3) drivers. Other bits of the version fields are the version info.
+ * (3) drivers. Other bits of the version fields are the version info.
* JRR 010716
*/
cversion = major & 0x0000ffff;
@@ -1593,9 +1593,9 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
case 2: /* WinNT drivers */
case 3: /* Win2K drivers */
break;
-
+
default:
- DEBUG(6,("get_correct_cversion: cversion invalid [%s] cversion = %d\n",
+ DEBUG(6,("get_correct_cversion: cversion invalid [%s] cversion = %d\n",
driverpath, cversion));
goto error_exit;
}
@@ -1674,7 +1674,7 @@ static WERROR clean_up_driver_struct_level_3(struct pipes_struct *rpc_pipe,
if (!architecture) {
return WERR_UNKNOWN_PRINTER_DRIVER;
}
-
+
/* jfm:7/16/2000 the client always sends the cversion=0.
* The server should check which version the driver is by reading
* the PE header of driver->driverpath.
@@ -1693,7 +1693,7 @@ static WERROR clean_up_driver_struct_level_3(struct pipes_struct *rpc_pipe,
return WERR_OK;
}
-
+
/****************************************************************************
****************************************************************************/
static WERROR clean_up_driver_struct_level_6(struct pipes_struct *rpc_pipe,
@@ -2158,10 +2158,10 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver)
return (uint32)-1;
}
- /* .inf files do not always list a file for each of the four standard files.
+ /* .inf files do not always list a file for each of the four standard files.
* Don't prepend a path to a null filename, or client claims:
- * "The server on which the printer resides does not have a suitable
- * <printer driver name> printer driver installed. Click OK if you
+ * "The server on which the printer resides does not have a suitable
+ * <printer driver name> printer driver installed. Click OK if you
* wish to install the driver on your local machine."
*/
if (strlen(driver->driverpath)) {
@@ -2278,7 +2278,7 @@ static WERROR get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **in
fstrcpy(info.name, driver);
fstrcpy(info.defaultdatatype, "RAW");
-
+
fstrcpy(info.driverpath, "");
fstrcpy(info.datafile, "");
fstrcpy(info.configfile, "");
@@ -2295,7 +2295,7 @@ static WERROR get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **in
SAFE_FREE(info.dependentfiles);
return WERR_NOMEM;
}
-
+
return WERR_OK;
}
@@ -2389,9 +2389,9 @@ static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32
uint32 result;
NT_PRINTER_DRIVER_INFO_LEVEL_3 *info3;
int i;
-
+
DEBUG(20,("Dumping printer driver at level [%d]\n", level));
-
+
switch (level)
{
case 3:
@@ -2400,7 +2400,7 @@ static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32
result=5;
else {
info3=driver.info_3;
-
+
DEBUGADD(20,("version:[%d]\n", info3->cversion));
DEBUGADD(20,("name:[%s]\n", info3->name));
DEBUGADD(20,("environment:[%s]\n", info3->environment));
@@ -2410,7 +2410,7 @@ static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32
DEBUGADD(20,("helpfile:[%s]\n", info3->helpfile));
DEBUGADD(20,("monitorname:[%s]\n", info3->monitorname));
DEBUGADD(20,("defaultdatatype:[%s]\n", info3->defaultdatatype));
-
+
for (i=0; info3->dependentfiles &&
*info3->dependentfiles[i]; i++) {
DEBUGADD(20,("dependentfile:[%s]\n",
@@ -2425,7 +2425,7 @@ static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32
result=1;
break;
}
-
+
return result;
}
@@ -2462,7 +2462,7 @@ int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen)
nt_devmode->ttoption,
nt_devmode->collate,
nt_devmode->logpixels,
-
+
nt_devmode->fields,
nt_devmode->bitsperpel,
nt_devmode->pelswidth,
@@ -2595,7 +2595,7 @@ static WERROR update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
int retlen;
WERROR ret;
TDB_DATA kbuf, dbuf;
-
+
/*
* in addprinter: no servername and the printer is the name
* in setprinter: servername is \\server
@@ -2710,8 +2710,8 @@ NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename)
ZERO_STRUCTP(nt_devmode);
--
Samba Shared Repository
More information about the samba-cvs
mailing list