*/
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;
}
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;
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));
}
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;
/* 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);
/* 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));
/* 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);
/* 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);
/* 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);
/* 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);
/* 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;
/* 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;
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)
{
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;
}
(*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;
}
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) {
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 name> 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 ));
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;
}
- 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;
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;
{
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);
}
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
/* 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;
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"));
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);
*/
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);
int njobs, i;
njobs = print_queue_status(snum, &queue, &status);
- for (i=0;i<njobs;i++) {
- if (print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
+
+ if (print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
+ for (i=0;i<njobs;i++) {
print_job_delete1(queue[i].job);
}
}
}
done:
- DEBUG(10, ("sec_equal(): secdescs are identical\n"));
+ DEBUG(10, ("sec_desc_equal(): secdescs are identical\n"));
return True;
}
********************************************************************/
static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername)
{
- pstring temp_driverpath;
- pstring temp_datafile;
- pstring temp_configfile;
+ pstring temp;
info->version=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, "" );
}
/********************************************************************
********************************************************************/
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);
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 );
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);
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 );
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));
}
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));
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
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);
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);
*/
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"));
}
*/
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"));
}
/* 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) {
/* 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) {
int main(int argc, char **argv)
{
+ pstring servicesf = CONFIGFILE;
+
/* Argument check */
if (argc == 1) {
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) {