summaryrefslogtreecommitdiffstats
path: root/source/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-01-10 17:47:53 +0000
committerJeremy Allison <jra@samba.org>2007-01-10 17:47:53 +0000
commit82311a1f42f7dbb888f013ebcd183bba099db9c1 (patch)
treea7d4dfa31550d90d99ccfb61fb036249e9841caa /source/printing
parentf7675bca8275347c69da4241f7bf5a412005fd4a (diff)
downloadsamba-82311a1f42f7dbb888f013ebcd183bba099db9c1.tar.gz
samba-82311a1f42f7dbb888f013ebcd183bba099db9c1.tar.xz
samba-82311a1f42f7dbb888f013ebcd183bba099db9c1.zip
r20655: After consulting with Volker, fix our pathname
handling. Gets rid of more code than it adds. I will port this to SAMBA_3_0 next. There are still some wrinkles with wildcard delete I am working on - for example a dirtype pattern of 0x8aa4 isn't handled correctly yet.... still looking at this. Jeremy.
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/nt_printing.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index 541a60fef14..1fcd1a12338 100644
--- a/source/printing/nt_printing.c
+++ b/source/printing/nt_printing.c
@@ -656,13 +656,13 @@ BOOL nt_printing_init(void)
Function to allow filename parsing "the old way".
********************************************************************/
-static BOOL driver_unix_convert(char *name,connection_struct *conn,
- char *saved_last_component, BOOL *bad_path, SMB_STRUCT_STAT *pst)
+static void driver_unix_convert(char *name,connection_struct *conn,
+ char *saved_last_component, SMB_STRUCT_STAT *pst)
{
unix_format(name);
unix_clean_name(name);
trim_string(name,"/","/");
- return unix_convert(name, conn, saved_last_component, bad_path, pst);
+ unix_convert(name, conn, saved_last_component, pst);
}
/*******************************************************************
@@ -1279,7 +1279,6 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
files_struct *fsp = NULL;
SMB_STRUCT_STAT st;
SMB_STRUCT_STAT stat_buf;
- BOOL bad_path;
NTSTATUS status;
@@ -1291,7 +1290,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
/* Get file version info (if available) for previous file (if it exists) */
pstrcpy(filepath, old_file);
- driver_unix_convert(filepath,conn,NULL,&bad_path,&stat_buf);
+ driver_unix_convert(filepath,conn,NULL,&stat_buf);
status = open_file_ntcreate(conn, filepath, &stat_buf,
FILE_GENERIC_READ,
@@ -1327,7 +1326,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
/* Get file version info (if available) for new file */
pstrcpy(filepath, new_file);
- driver_unix_convert(filepath,conn,NULL,&bad_path,&stat_buf);
+ driver_unix_convert(filepath,conn,NULL,&stat_buf);
status = open_file_ntcreate(conn, filepath, &stat_buf,
FILE_GENERIC_READ,
@@ -1404,7 +1403,6 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
DATA_BLOB null_pw;
fstring res_type;
files_struct *fsp = NULL;
- BOOL bad_path;
SMB_STRUCT_STAT st;
connection_struct *conn;
NTSTATUS status;
@@ -1456,7 +1454,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
* deriver the cversion. */
slprintf(driverpath, sizeof(driverpath)-1, "%s/%s", architecture, driverpath_in);
- driver_unix_convert(driverpath,conn,NULL,&bad_path,&st);
+ driver_unix_convert(driverpath,conn,NULL,&st);
if ( !vfs_file_exist( conn, driverpath, &st ) ) {
*perr = WERR_BADFILE;
@@ -1742,7 +1740,6 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
pstring inbuf;
pstring outbuf;
fstring res_type;
- BOOL bad_path;
SMB_STRUCT_STAT st;
int ver = 0;
int i;
@@ -1799,7 +1796,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
*/
DEBUG(5,("Creating first directory\n"));
slprintf(new_dir, sizeof(new_dir)-1, "%s/%d", architecture, driver->cversion);
- driver_unix_convert(new_dir, conn, NULL, &bad_path, &st);
+ driver_unix_convert(new_dir, conn, NULL, &st);
create_directory(conn, new_dir);
/* For each driver file, archi\filexxx.yyy, if there is a duplicate file
@@ -1825,7 +1822,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
slprintf(new_name, sizeof(new_name)-1, "%s/%s", architecture, driver->driverpath);
slprintf(old_name, sizeof(old_name)-1, "%s/%s", new_dir, driver->driverpath);
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
+ driver_unix_convert(new_name, conn, NULL, &st);
if ( !copy_file(new_name, old_name, conn, OPENX_FILE_EXISTS_TRUNCATE|
OPENX_FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
@@ -1841,7 +1838,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
slprintf(new_name, sizeof(new_name)-1, "%s/%s", architecture, driver->datafile);
slprintf(old_name, sizeof(old_name)-1, "%s/%s", new_dir, driver->datafile);
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
+ driver_unix_convert(new_name, conn, NULL, &st);
if ( !copy_file(new_name, old_name, conn, OPENX_FILE_EXISTS_TRUNCATE|
OPENX_FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
@@ -1859,7 +1856,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
slprintf(new_name, sizeof(new_name)-1, "%s/%s", architecture, driver->configfile);
slprintf(old_name, sizeof(old_name)-1, "%s/%s", new_dir, driver->configfile);
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
+ driver_unix_convert(new_name, conn, NULL, &st);
if ( !copy_file(new_name, old_name, conn, OPENX_FILE_EXISTS_TRUNCATE|
OPENX_FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
@@ -1878,7 +1875,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
slprintf(new_name, sizeof(new_name)-1, "%s/%s", architecture, driver->helpfile);
slprintf(old_name, sizeof(old_name)-1, "%s/%s", new_dir, driver->helpfile);
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
+ driver_unix_convert(new_name, conn, NULL, &st);
if ( !copy_file(new_name, old_name, conn, OPENX_FILE_EXISTS_TRUNCATE|
OPENX_FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
DEBUG(0,("move_driver_to_download_area: Unable to rename [%s] to [%s]\n",
@@ -1906,7 +1903,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract
slprintf(new_name, sizeof(new_name)-1, "%s/%s", architecture, driver->dependentfiles[i]);
slprintf(old_name, sizeof(old_name)-1, "%s/%s", new_dir, driver->dependentfiles[i]);
if (ver != -1 && (ver=file_version_is_newer(conn, new_name, old_name)) > 0) {
- driver_unix_convert(new_name, conn, NULL, &bad_path, &st);
+ driver_unix_convert(new_name, conn, NULL, &st);
if ( !copy_file(new_name, old_name, conn,
OPENX_FILE_EXISTS_TRUNCATE|
OPENX_FILE_CREATE_IF_NOT_EXIST, 0, False, &err) ) {
@@ -4813,7 +4810,6 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
DATA_BLOB null_pw;
NTSTATUS nt_status;
fstring res_type;
- BOOL bad_path;
SMB_STRUCT_STAT st;
if ( !info_3 )
@@ -4856,7 +4852,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
if ( *info_3->driverpath ) {
if ( (s = strchr( &info_3->driverpath[1], '\\' )) != NULL ) {
pstrcpy( file, s );
- driver_unix_convert(file, conn, NULL, &bad_path, &st);
+ driver_unix_convert(file, conn, NULL, &st);
DEBUG(10,("deleting driverfile [%s]\n", s));
unlink_internals(conn, 0, file, False);
}
@@ -4865,7 +4861,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
if ( *info_3->configfile ) {
if ( (s = strchr( &info_3->configfile[1], '\\' )) != NULL ) {
pstrcpy( file, s );
- driver_unix_convert(file, conn, NULL, &bad_path, &st);
+ driver_unix_convert(file, conn, NULL, &st);
DEBUG(10,("deleting configfile [%s]\n", s));
unlink_internals(conn, 0, file, False);
}
@@ -4874,7 +4870,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
if ( *info_3->datafile ) {
if ( (s = strchr( &info_3->datafile[1], '\\' )) != NULL ) {
pstrcpy( file, s );
- driver_unix_convert(file, conn, NULL, &bad_path, &st);
+ driver_unix_convert(file, conn, NULL, &st);
DEBUG(10,("deleting datafile [%s]\n", s));
unlink_internals(conn, 0, file, False);
}
@@ -4883,7 +4879,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
if ( *info_3->helpfile ) {
if ( (s = strchr( &info_3->helpfile[1], '\\' )) != NULL ) {
pstrcpy( file, s );
- driver_unix_convert(file, conn, NULL, &bad_path, &st);
+ driver_unix_convert(file, conn, NULL, &st);
DEBUG(10,("deleting helpfile [%s]\n", s));
unlink_internals(conn, 0, file, False);
}
@@ -4899,7 +4895,7 @@ static BOOL delete_driver_files( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct
if ( (p = strchr( info_3->dependentfiles[i]+1, '\\' )) != NULL ) {
pstrcpy( file, p );
- driver_unix_convert(file, conn, NULL, &bad_path, &st);
+ driver_unix_convert(file, conn, NULL, &st);
DEBUG(10,("deleting dependent file [%s]\n", file));
unlink_internals(conn, 0, file, False);
}