From: David O'Neill Date: Thu, 11 Jan 2001 20:41:19 +0000 (+0000) Subject: Changes from APPLIANCE_HEAD: X-Git-Tag: samba-4.0.0alpha6~801^2~18851 X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=commitdiff_plain;h=3380ffae9c231a34406dd694c9ab03bb0b6d8070;hp=a4763f59382a66a2ad45ce6ba88fe03faca18714 Changes from APPLIANCE_HEAD: testsuite/printing/psec.c - Use lock directory from smb.conf parameter when peeking at the ntdrivers.tdb file. source/rpc_parse/parse_sec.c - fix typo in debug message source/script/installbin.sh - create private directory as part of 'make install'. source/nsswitch/winbindd_cache.c source/nsswitch/winbindd_idmap.c source/passdb/secrets.c source/smbd/connection.c - always convert tdb key to unix code-page when generating. source/printing/nt_printing.c - always convert tdb key to unix code-page when generating. - don't prepend path to a filename that is NULL in add_a_printer_driver_3(). source/rpc_server/srv_spoolss_nt.c - always convert tdb key to unix code-page when generating. - don't prepend server name to a path/filename that is NULL in the fill_printer_driver_info functions. source/printing/printing.c - always convert tdb key to unix code-page when generating. - move access check for print_queue_purge() outside of job delete loop. source/smbd/unix_acls.c - fix for setting ACLs (this got missed earlier) source/lib/messages.c - trivial sync with appliance_head (This used to be commit 376601d17d53ef7bfaafa576bd770e554516e808) --- diff --git a/source3/lib/messages.c b/source3/lib/messages.c index bc6f2099381..94c04cfa8e6 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -161,8 +161,8 @@ BOOL message_send_pid(pid_t pid, int msg_type, void *buf, size_t len, BOOL dupli */ if (!process_exists(pid)) { - tdb_delete(tdb, message_key_pid(pid)); DEBUG(2,("message_send_pid: pid %d doesn't exist\n", (int)pid)); + tdb_delete(tdb, message_key_pid(pid)); return False; } diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c index cd648c696c7..226a96b9b50 100644 --- a/source3/nsswitch/winbindd_cache.c +++ b/source3/nsswitch/winbindd_cache.c @@ -56,6 +56,7 @@ static uint32 cached_sequence_number(char *domain_name) time_t t = time(NULL); slprintf(keystr, sizeof(keystr), "CACHESEQ/%s", domain_name); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ dbuf = tdb_fetch_by_string(cache_tdb, keystr); if (!dbuf.dptr || dbuf.dsize != sizeof(rec)) { goto refetch; @@ -92,6 +93,7 @@ static void set_cache_sequence_number(char *domain_name, char *cache_type, char fstring keystr; slprintf(keystr,sizeof(keystr),"CACHESEQ %s/%s/%s", domain_name, cache_type, subkey?subkey:""); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ tdb_store_int(cache_tdb, keystr, cached_sequence_number(domain_name)); } @@ -101,6 +103,7 @@ static uint32 get_cache_sequence_number(char *domain_name, char *cache_type, cha uint32 seq_num; slprintf(keystr,sizeof(keystr),"CACHESEQ %s/%s/%s", domain_name, cache_type, subkey?subkey:""); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ seq_num = (uint32)tdb_fetch_int(cache_tdb, keystr); DEBUG(4,("%s is %u\n", keystr, (unsigned)seq_num)); return seq_num; @@ -124,7 +127,7 @@ static void fill_cache(char *domain_name, char *cache_type, /* Store data as a mega-huge chunk in the tdb */ slprintf(keystr, sizeof(keystr), "%s CACHE DATA/%s", cache_type, domain_name); - + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ tdb_store_by_string(cache_tdb, keystr, sam_entries, sizeof(struct acct_info) * num_sam_entries); @@ -156,6 +159,7 @@ static void fill_cache_entry(char *domain, char *cache_type, char *name, void *b /* Create key for store */ slprintf(keystr, sizeof(keystr), "%s/%s/%s", cache_type, domain, name); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ DEBUG(4, ("filling cache entry %s\n", keystr)); @@ -200,6 +204,7 @@ void winbindd_fill_group_cache_entry(char *domain, char *group_name, /* Fill extra data */ slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain, group_name); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ tdb_store_by_string(cache_tdb, keystr, extra_data, extra_data_len); set_cache_sequence_number(domain, CACHE_TYPE_GROUP, group_name); @@ -222,6 +227,7 @@ void winbindd_fill_gid_cache_entry(char *domain, gid_t gid, /* Fill extra data */ slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain, gidstr); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ tdb_store_by_string(cache_tdb, keystr, extra_data, extra_data_len); set_cache_sequence_number(domain, CACHE_TYPE_GROUP, gidstr); @@ -250,6 +256,7 @@ static BOOL fetch_cache(char *domain_name, char *cache_type, /* Create key */ slprintf(keystr, sizeof(keystr), "%s CACHE DATA/%s", cache_type, domain_name); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ /* Fetch cache information */ data = tdb_fetch_by_string(cache_tdb, keystr); @@ -298,6 +305,7 @@ static BOOL fetch_cache_entry(char *domain, char *cache_type, char *name, void * /* Create key for lookup */ slprintf(keystr, sizeof(keystr), "%s/%s/%s", cache_type, domain, name); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ /* Look up cache entry */ data = tdb_fetch_by_string(cache_tdb, keystr); @@ -362,6 +370,7 @@ BOOL winbindd_fetch_group_cache_entry(char *domain_name, char *group, /* Fetch extra data */ slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain_name, group); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ data = tdb_fetch_by_string(cache_tdb, keystr); if (!data.dptr) return False; @@ -399,6 +408,7 @@ BOOL winbindd_fetch_gid_cache_entry(char *domain_name, gid_t gid, /* Fetch extra data */ slprintf(keystr, sizeof(keystr), "%s/%s/%s DATA", CACHE_TYPE_GROUP, domain_name, gidstr); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ data = tdb_fetch_by_string(cache_tdb, keystr); if (!data.dptr) return False; diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index a09b45ad745..9591474861a 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -99,6 +99,7 @@ BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid) size_t size; slprintf(key, sizeof(key), "%s/%s", SECRETS_DOMAIN_SID, domain); + dos_to_unix(key, True); /* Convert key to unix-codepage */ dyn_sid = (DOM_SID *)secrets_fetch(key, &size); if (dyn_sid == NULL) @@ -123,6 +124,7 @@ char *trust_keystr(char *domain) { static fstring keystr; slprintf(keystr,sizeof(keystr),"%s/%s", SECRETS_MACHINE_ACCT_PASS, domain); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ return keystr; } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 699ddc60b2c..2572a98bdea 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -144,6 +144,7 @@ int write_ntforms(nt_forms_struct **list, int number) (*list)[i].bottom); if (len > sizeof(buf)) break; slprintf(key, sizeof(key), "%s%s", FORMS_PREFIX, (*list)[i].name); + dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dsize = strlen(key)+1; kbuf.dptr = key; dbuf.dsize = len; @@ -235,6 +236,7 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32 } slprintf(key, sizeof(key), "%s%s", FORMS_PREFIX, (*list)[n].name); + dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dsize = strlen(key)+1; kbuf.dptr = key; if (tdb_delete(tdb, kbuf) != 0) { @@ -1301,27 +1303,41 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver) slprintf(directory, sizeof(directory), "\\print$\\%s\\%d\\", architecture, driver->cversion); - - fstrcpy(temp_name, driver->driverpath); - slprintf(driver->driverpath, sizeof(driver->driverpath), "%s%s", directory, temp_name); + /* .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 installed. Click OK if you + * wish to install the driver on your local machine." + */ + if (strlen(driver->driverpath)) { + fstrcpy(temp_name, driver->driverpath); + slprintf(driver->driverpath, sizeof(driver->driverpath), "%s%s", directory, temp_name); + } - fstrcpy(temp_name, driver->datafile); - slprintf(driver->datafile, sizeof(driver->datafile), "%s%s", directory, temp_name); + if (strlen(driver->datafile)) { + fstrcpy(temp_name, driver->datafile); + slprintf(driver->datafile, sizeof(driver->datafile), "%s%s", directory, temp_name); + } - fstrcpy(temp_name, driver->configfile); - slprintf(driver->configfile, sizeof(driver->configfile), "%s%s", directory, temp_name); + if (strlen(driver->configfile)) { + fstrcpy(temp_name, driver->configfile); + slprintf(driver->configfile, sizeof(driver->configfile), "%s%s", directory, temp_name); + } - fstrcpy(temp_name, driver->helpfile); - slprintf(driver->helpfile, sizeof(driver->helpfile), "%s%s", directory, temp_name); + if (strlen(driver->helpfile)) { + fstrcpy(temp_name, driver->helpfile); + slprintf(driver->helpfile, sizeof(driver->helpfile), "%s%s", directory, temp_name); + } if (driver->dependentfiles) { for (i=0; *driver->dependentfiles[i]; i++) { - fstrcpy(temp_name, driver->dependentfiles[i]); - slprintf(driver->dependentfiles[i], sizeof(driver->dependentfiles[i]), "%s%s", directory, temp_name); + fstrcpy(temp_name, driver->dependentfiles[i]); + slprintf(driver->dependentfiles[i], sizeof(driver->dependentfiles[i]), "%s%s", directory, temp_name); } } slprintf(key, sizeof(key), "%s%s/%d/%s", DRIVERS_PREFIX, architecture, driver->cversion, driver->name); + dos_to_unix(key, True); /* Convert key to unix-codepage */ DEBUG(5,("add_a_printer_driver_3: Adding driver with key %s\n", key )); @@ -1685,8 +1701,8 @@ uint32 del_a_printer(char *sharename) pstring key; TDB_DATA kbuf; - slprintf(key, sizeof(key), "%s%s", - PRINTERS_PREFIX, sharename); + slprintf(key, sizeof(key), "%s%s", PRINTERS_PREFIX, sharename); + dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dptr=key; kbuf.dsize=strlen(key)+1; @@ -1768,8 +1784,8 @@ static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info) } - slprintf(key, sizeof(key), "%s%s", - PRINTERS_PREFIX, info->sharename); + slprintf(key, sizeof(key), "%s%s", PRINTERS_PREFIX, info->sharename); + dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dptr = key; kbuf.dsize = strlen(key)+1; @@ -2196,6 +2212,7 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen ZERO_STRUCT(info); slprintf(key, sizeof(key), "%s%s", PRINTERS_PREFIX, sharename); + dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dptr = key; kbuf.dsize = strlen(key)+1; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index cfe194ab173..3f8c542ec7d 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -304,6 +304,7 @@ static void print_cache_flush(int snum) { fstring key; slprintf(key, sizeof(key), "CACHE/%s", lp_servicename(snum)); + dos_to_unix(key, True); /* Convert key to unix-codepage */ tdb_store_int(tdb, key, -1); } @@ -324,8 +325,11 @@ static void print_queue_update(int snum) struct traverse_struct tstruct; fstring keystr, printer_name; TDB_DATA data, key; - + + /* Convert printer name (i.e. share name) to unix-codepage for all of the + * following tdb key generation */ fstrcpy(printer_name, lp_servicename(snum)); + dos_to_unix(printer_name, True); /* * Update the cache time FIRST ! Stops others doing this @@ -428,7 +432,7 @@ static void print_queue_update(int snum) /* store the new queue status structure */ slprintf(keystr, sizeof(keystr), "STATUS/%s", printer_name); - key.dptr = keystr; + key.dptr = keystr; key.dsize = strlen(keystr); status.qcount = qcount; @@ -722,6 +726,7 @@ static BOOL print_cache_expired(int snum) time_t t2, t = time(NULL); slprintf(key, sizeof(key), "CACHE/%s", lp_servicename(snum)); + dos_to_unix(key, True); /* Convert key to unix-codepage */ t2 = tdb_fetch_int(tdb, key); if (t2 == ((time_t)-1) || (t - t2) >= lp_lpqcachetime()) { DEBUG(3, ("print cache expired\n")); @@ -741,6 +746,7 @@ static int get_queue_status(int snum, print_status_struct *status) ZERO_STRUCTP(status); slprintf(keystr, sizeof(keystr), "STATUS/%s", lp_servicename(snum)); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ key.dptr = keystr; key.dsize = strlen(keystr); data = tdb_fetch(tdb, key); @@ -1065,6 +1071,7 @@ int print_queue_status(int snum, */ ZERO_STRUCTP(status); slprintf(keystr, sizeof(keystr), "STATUS/%s", lp_servicename(snum)); + dos_to_unix(keystr, True); /* Convert key to unix-codepage */ key.dptr = keystr; key.dsize = strlen(keystr); data = tdb_fetch(tdb, key); @@ -1203,8 +1210,9 @@ BOOL print_queue_purge(struct current_user *user, int snum, int *errcode) int njobs, i; njobs = print_queue_status(snum, &queue, &status); - for (i=0;iversion=driver.info_3->cversion; init_unistr( &info->name, driver.info_3->name ); init_unistr( &info->architecture, driver.info_3->environment ); - snprintf(temp_driverpath, sizeof(temp_driverpath)-1, "\\\\%s%s", servername, driver.info_3->driverpath); - init_unistr( &info->driverpath, temp_driverpath ); - snprintf(temp_datafile, sizeof(temp_datafile)-1, "\\\\%s%s", servername, driver.info_3->datafile); - init_unistr( &info->datafile, temp_datafile ); + if (strlen(driver.info_3->driverpath)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->driverpath); + init_unistr( &info->driverpath, temp ); + } else + init_unistr( &info->driverpath, "" ); - snprintf(temp_configfile, sizeof(temp_configfile)-1, "\\\\%s%s", servername, driver.info_3->configfile); - init_unistr( &info->configfile, temp_configfile ); + if (strlen(driver.info_3->datafile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->datafile); + init_unistr( &info->datafile, temp ); + } else + init_unistr( &info->datafile, "" ); + + if (strlen(driver.info_3->configfile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->configfile); + init_unistr( &info->configfile, temp ); + } else + init_unistr( &info->configfile, "" ); } /******************************************************************** @@ -2830,10 +2838,7 @@ static void init_unistr_array(uint16 **uni_array, fstring *char_array, char *ser ********************************************************************/ static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername) { - pstring temp_driverpath; - pstring temp_datafile; - pstring temp_configfile; - pstring temp_helpfile; + pstring temp; ZERO_STRUCTP(info); @@ -2842,17 +2847,29 @@ static void fill_printer_driver_info_3(DRIVER_INFO_3 *info, NT_PRINTER_DRIVER_IN init_unistr( &info->name, driver.info_3->name ); init_unistr( &info->architecture, driver.info_3->environment ); - snprintf(temp_driverpath, sizeof(temp_driverpath)-1, "\\\\%s%s", servername, driver.info_3->driverpath); - init_unistr( &info->driverpath, temp_driverpath ); - - snprintf(temp_datafile, sizeof(temp_datafile)-1, "\\\\%s%s", servername, driver.info_3->datafile); - init_unistr( &info->datafile, temp_datafile ); - - snprintf(temp_configfile, sizeof(temp_configfile)-1, "\\\\%s%s", servername, driver.info_3->configfile); - init_unistr( &info->configfile, temp_configfile ); - - snprintf(temp_helpfile, sizeof(temp_helpfile)-1, "\\\\%s%s", servername, driver.info_3->helpfile); - init_unistr( &info->helpfile, temp_helpfile ); + if (strlen(driver.info_3->driverpath)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->driverpath); + init_unistr( &info->driverpath, temp ); + } else + init_unistr( &info->driverpath, "" ); + + if (strlen(driver.info_3->datafile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->datafile); + init_unistr( &info->datafile, temp ); + } else + init_unistr( &info->datafile, "" ); + + if (strlen(driver.info_3->configfile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->configfile); + init_unistr( &info->configfile, temp ); + } else + init_unistr( &info->configfile, "" ); + + if (strlen(driver.info_3->helpfile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->helpfile); + init_unistr( &info->helpfile, temp ); + } else + init_unistr( &info->helpfile, "" ); init_unistr( &info->monitorname, driver.info_3->monitorname ); init_unistr( &info->defaultdatatype, driver.info_3->defaultdatatype ); @@ -2898,10 +2915,7 @@ static uint32 construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, fst static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername) { - pstring temp_driverpath; - pstring temp_datafile; - pstring temp_configfile; - pstring temp_helpfile; + pstring temp; fstring nullstr; ZERO_STRUCTP(info); @@ -2912,18 +2926,30 @@ static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_IN init_unistr( &info->name, driver.info_3->name ); init_unistr( &info->architecture, driver.info_3->environment ); - snprintf(temp_driverpath, sizeof(temp_driverpath)-1, "\\\\%s%s", servername, driver.info_3->driverpath); - init_unistr( &info->driverpath, temp_driverpath ); - - snprintf(temp_datafile, sizeof(temp_datafile)-1, "\\\\%s%s", servername, driver.info_3->datafile); - init_unistr( &info->datafile, temp_datafile ); - - snprintf(temp_configfile, sizeof(temp_configfile)-1, "\\\\%s%s", servername, driver.info_3->configfile); - init_unistr( &info->configfile, temp_configfile ); - - snprintf(temp_helpfile, sizeof(temp_helpfile)-1, "\\\\%s%s", servername, driver.info_3->helpfile); - init_unistr( &info->helpfile, temp_helpfile ); - + if (strlen(driver.info_3->driverpath)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->driverpath); + init_unistr( &info->driverpath, temp ); + } else + init_unistr( &info->driverpath, "" ); + + if (strlen(driver.info_3->datafile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->datafile); + init_unistr( &info->datafile, temp ); + } else + init_unistr( &info->datafile, "" ); + + if (strlen(driver.info_3->configfile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->configfile); + init_unistr( &info->configfile, temp ); + } else + init_unistr( &info->configfile, "" ); + + if (strlen(driver.info_3->helpfile)) { + snprintf(temp, sizeof(temp)-1, "\\\\%s%s", servername, driver.info_3->helpfile); + init_unistr( &info->helpfile, temp ); + } else + init_unistr( &info->helpfile, "" ); + init_unistr( &info->monitorname, driver.info_3->monitorname ); init_unistr( &info->defaultdatatype, driver.info_3->defaultdatatype ); @@ -3547,8 +3573,8 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer) unlink(tmp_file); - /* Convert script args to unix-codepage */ - dos_to_unix(command, True); + /* Convert script args to unix-codepage */ + dos_to_unix(command, True); DEBUG(10,("Running [%s > %s]\n", command,tmp_file)); ret = smbrun(command, tmp_file, False); DEBUGADD(10,("returned [%d]\n", ret)); @@ -3559,7 +3585,7 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer) } numlines = 0; - /* Get lines and convert them back to dos-codepage */ + /* Get lines and convert them back to dos-codepage */ qlines = file_lines_load(tmp_file, &numlines, True); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); DEBUGADD(10,("Unlinking script output file [%s]\n", tmp_file)); diff --git a/source3/script/installbin.sh b/source3/script/installbin.sh index 69cca942953..77bded6420f 100755 --- a/source3/script/installbin.sh +++ b/source3/script/installbin.sh @@ -11,7 +11,7 @@ shift shift shift -for d in $BASEDIR $BINDIR $LIBDIR $VARDIR; do +for d in $BASEDIR $BINDIR $LIBDIR $VARDIR $BASEDIR/private; do if [ ! -d $d ]; then mkdir $d if [ ! -d $d ]; then diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index b0b4bbab7b7..8ab4e0c5d3f 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -57,6 +57,7 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections) key.pid = sys_getpid(); key.cnum = conn?conn->cnum:-1; fstrcpy(key.name, name); + dos_to_unix(key.name, True); /* Convert key to unix-codepage */ kbuf.dptr = (char *)&key; kbuf.dsize = sizeof(key); @@ -93,6 +94,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO key.pid = sys_getpid(); key.cnum = conn?conn->cnum:-1; fstrcpy(key.name, name); + dos_to_unix(key.name, True); /* Convert key to unix-codepage */ kbuf.dptr = (char *)&key; kbuf.dsize = sizeof(key); diff --git a/source3/smbd/unix_acls.c b/source3/smbd/unix_acls.c index 2e16611b0cb..9ab057f77aa 100644 --- a/source3/smbd/unix_acls.c +++ b/source3/smbd/unix_acls.c @@ -186,6 +186,7 @@ static BOOL unpack_nt_permissions(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *p */ if (security_info_sent & OWNER_SECURITY_INFORMATION) { + sid_copy(&owner_sid, psd->owner_sid); if (!sid_to_uid( &owner_sid, puser, &sid_type)) DEBUG(3,("unpack_nt_permissions: unable to validate owner sid.\n")); } @@ -196,6 +197,7 @@ static BOOL unpack_nt_permissions(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *p */ if (security_info_sent & GROUP_SECURITY_INFORMATION) { + sid_copy(&grp_sid, psd->grp_sid); if (!sid_to_gid( &grp_sid, pgrp, &sid_type)) DEBUG(3,("unpack_nt_permissions: unable to validate group sid.\n")); } diff --git a/testsuite/printing/psec.c b/testsuite/printing/psec.c index 88a111404c9..9d38b9b10ae 100644 --- a/testsuite/printing/psec.c +++ b/testsuite/printing/psec.c @@ -169,7 +169,9 @@ int psec_getsec(char *printer) /* Open tdb for reading */ - slprintf(tdb_path, sizeof(tdb_path) - 1, "%s/ntdrivers.tdb", LOCKDIR); + slprintf(tdb_path, sizeof(tdb_path) - 1, "%s/ntdrivers.tdb", + lp_lockdir()); + tdb = tdb_open(tdb_path, 0, 0, O_RDONLY, 0600); if (!tdb) { @@ -268,7 +270,9 @@ int psec_setsec(char *printer) /* Open tdb for reading */ - slprintf(tdb_path, sizeof(tdb_path) - 1, "%s/ntdrivers.tdb", LOCKDIR); + slprintf(tdb_path, sizeof(tdb_path) - 1, "%s/ntdrivers.tdb", + lp_lockdir()); + tdb = tdb_open(tdb_path, 0, 0, O_RDWR, 0600); if (!tdb) { @@ -381,6 +385,8 @@ void usage(void) int main(int argc, char **argv) { + pstring servicesf = CONFIGFILE; + /* Argument check */ if (argc == 1) { @@ -388,6 +394,16 @@ int main(int argc, char **argv) return 1; } + /* Load smb.conf file */ + + charset_initialise(); + + if (!lp_load(servicesf,False,False,True)) { + fprintf(stderr, "Couldn't load confiuration file %s\n", + servicesf); + return 1; + } + /* Do commands */ if (strcmp(argv[1], "setsec") == 0) {