Changes from APPLIANCE_HEAD:
authorDavid O'Neill <dmo@samba.org>
Thu, 11 Jan 2001 20:41:19 +0000 (20:41 +0000)
committerDavid O'Neill <dmo@samba.org>
Thu, 11 Jan 2001 20:41:19 +0000 (20:41 +0000)
    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)

source3/lib/messages.c
source3/nsswitch/winbindd_cache.c
source3/passdb/secrets.c
source3/printing/nt_printing.c
source3/printing/printing.c
source3/rpc_parse/parse_sec.c
source3/rpc_server/srv_spoolss_nt.c
source3/script/installbin.sh
source3/smbd/connection.c
source3/smbd/unix_acls.c
testsuite/printing/psec.c

index bc6f20993810a9fa6723e430e621becbe39ffc55..94c04cfa8e67c5152b3da19afef4e19dc4e2b9a0 100644 (file)
@@ -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)) {
         */
 
        if (!process_exists(pid)) {
-               tdb_delete(tdb, message_key_pid(pid));
                DEBUG(2,("message_send_pid: pid %d doesn't exist\n", (int)pid));
                DEBUG(2,("message_send_pid: pid %d doesn't exist\n", (int)pid));
+               tdb_delete(tdb, message_key_pid(pid));
                return False;
        }
 
                return False;
        }
 
index cd648c696c7d13c76e644a10ba849a5d5449fc59..226a96b9b50003026db9aca14de9df903be83cb7 100644 (file)
@@ -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);
        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;
        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:"");
        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));
 }
 
        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:"");
        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;
        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);
        /* 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);
 
        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);
 
        /* 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));
 
 
        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);
 
         /* 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);
         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);
 
         /* 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);
         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);
         /* 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);
        
         /* 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);
     
        /* 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);
     
        /* 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);
        
         /* 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;
         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);
 
         /* 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;
 
         data = tdb_fetch_by_string(cache_tdb, keystr);
         if (!data.dptr) return False;
 
index a09b45ad74559e53e80ba41affe5ba2649406e5a..9591474861a8d652c49b714ac15e68bf177fa62f 100644 (file)
@@ -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);
        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)
        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);
 {
        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;
 }
 
        return keystr;
 }
 
index 699ddc60b2c1c5a105bdea17378387a502c66a75..2572a98bdea495315df7d9fa91ddaece0b6511a5 100644 (file)
@@ -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);
                               (*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;
                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);
        }
 
        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) {
        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);
 
 
        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++) {
 
        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);
                }
        }
 
        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 ));
 
 
        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;
 
        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;
 
        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;
 
        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);
        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;
 
        kbuf.dptr = key;
        kbuf.dsize = strlen(key)+1;
index cfe194ab1739b4ff3e326f6332c92e311c34ee1a..3f8c542ec7d57575ad8a0c996a0f34036f07da57 100644 (file)
@@ -304,6 +304,7 @@ static void print_cache_flush(int snum)
 {
        fstring key;
        slprintf(key, sizeof(key), "CACHE/%s", lp_servicename(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);
 }
 
        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;
        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));
        fstrcpy(printer_name, lp_servicename(snum));
+       dos_to_unix(printer_name, True);
        
        /*
         * Update the cache time FIRST ! Stops others doing this
        
        /*
         * 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);
 
        /* 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;
        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));
        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"));
        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));
 
        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);
        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));
         */
        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);
        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);
        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);
                }
        }
                        print_job_delete1(queue[i].job);
                }
        }
index e2ca2202e1647f0b8373daf2de467a1869bedf99..c2c8ad120c9848b136e7a74a959baf718cefcda7 100644 (file)
@@ -416,7 +416,7 @@ BOOL sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2)
        }
 
  done:
        }
 
  done:
-       DEBUG(10, ("sec_equal(): secdescs are identical\n"));
+       DEBUG(10, ("sec_desc_equal(): secdescs are identical\n"));
        return True;
 }
 
        return True;
 }
 
index 74cc19eee1579774ff8d9c3f94242e56f508e4aa..23f8ab15efb1ddfa9fc5a805a113aa3253def429 100644 (file)
@@ -2740,23 +2740,31 @@ static uint32 construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, fst
  ********************************************************************/
 static void fill_printer_driver_info_2(DRIVER_INFO_2 *info, NT_PRINTER_DRIVER_INFO_LEVEL driver, fstring servername)
 {
  ********************************************************************/
 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 );
 
 
        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, "" );
 }
 
 /********************************************************************
 }
 
 /********************************************************************
@@ -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)
 {
  ********************************************************************/
 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);
 
 
        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 );
 
        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 );
 
        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)
 {
 
 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);
        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 );
 
        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 );
 
        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);
 
 
        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));
        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;
        }
 
        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));
        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));
index 69cca942953e24771e388df1381e3b7e9836288e..77bded6420f18f4cb3bfc98d06ed58453e8710b6 100755 (executable)
@@ -11,7 +11,7 @@ shift
 shift
 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
 if [ ! -d $d ]; then
 mkdir $d
 if [ ! -d $d ]; then
index b0b4bbab7b7b67038e6263eae5e7f65f3f147444..8ab4e0c5d3f24cbd2e865ecc0fd4bdb88bf812d9 100644 (file)
@@ -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);
        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);
 
        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);
        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);
 
        kbuf.dptr = (char *)&key;
        kbuf.dsize = sizeof(key);
index 2e16611b0cb165767f72c9641a680d92149a23c2..9ab057f77aa3ed7cc2265e5057ef804fa9059b4a 100644 (file)
@@ -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) {
    */
 
   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 (!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) {
    */
 
   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"));
   }
     if (!sid_to_gid( &grp_sid, pgrp, &sid_type))
       DEBUG(3,("unpack_nt_permissions: unable to validate group sid.\n"));
   }
index 88a111404c9fdf5e66e11413f94f2743a60fb814..9d38b9b10aed60273077bc460d2bfb1cbba5bc66 100644 (file)
@@ -169,7 +169,9 @@ int psec_getsec(char *printer)
 
        /* Open tdb for reading */
 
 
        /* 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) {
        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 */
 
 
        /* 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) {
        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)
 {
 
 int main(int argc, char **argv)
 {
+       pstring servicesf = CONFIGFILE;
+
        /* Argument check */
 
        if (argc == 1) {
        /* Argument check */
 
        if (argc == 1) {
@@ -388,6 +394,16 @@ int main(int argc, char **argv)
                return 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) {
        /* Do commands */
 
        if (strcmp(argv[1], "setsec") == 0) {