diff options
author | Gerald Carter <jerry@samba.org> | 2002-06-27 18:10:56 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2002-06-27 18:10:56 +0000 |
commit | b5bc8aa0f68ceebfb5c0ec15ff93b0172cec36d8 (patch) | |
tree | b5802b221fe3e5e940190dfdd77c64aa56e49d74 | |
parent | 9a3e323ec261a1ee3a83f8c558583c3d4a53e06a (diff) | |
download | samba-b5bc8aa0f68ceebfb5c0ec15ff93b0172cec36d8.tar.gz samba-b5bc8aa0f68ceebfb5c0ec15ff93b0172cec36d8.tar.xz samba-b5bc8aa0f68ceebfb5c0ec15ff93b0172cec36d8.zip |
It's fairly obvious that no one has tried to upload a driver
to a Samba print server running HEAD in a while. This has been broken
since tridge's changes to make_connection() to not do the chdir()
to the connect_path. Sorry it took me so long to get around to fixing it.
The problem occured with our internal use of make_connection().
jerry
-rw-r--r-- | source/printing/nt_printing.c | 4 | ||||
-rw-r--r-- | source/smbd/service.c | 28 |
2 files changed, 30 insertions, 2 deletions
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c index 08d5ea430a5..0ec960b3f06 100644 --- a/source/printing/nt_printing.c +++ b/source/printing/nt_printing.c @@ -1064,7 +1064,7 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in, /* Null password is ok - we are already an authenticated user... */ null_pw = data_blob(NULL, 0); become_root(); - conn = make_connection("print$", null_pw, "A:", user->vuid, &nt_status); + conn = make_connection_with_chdir("print$", null_pw, "A:", user->vuid, &nt_status); unbecome_root(); if (conn == NULL) { @@ -1382,7 +1382,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, become_root(); null_pw = data_blob(NULL, 0); - conn = make_connection("print$", null_pw, "A:", user->vuid, &nt_status); + conn = make_connection_with_chdir("print$", null_pw, "A:", user->vuid, &nt_status); unbecome_root(); if (conn == NULL) { diff --git a/source/smbd/service.c b/source/smbd/service.c index caf1cef17a5..590e4cedfc8 100644 --- a/source/smbd/service.c +++ b/source/smbd/service.c @@ -704,6 +704,34 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, return(conn); } +/*************************************************************************************** + Simple wrapper function for make_connection() to include a call to + vfs_chdir() + **************************************************************************************/ + +connection_struct *make_connection_with_chdir(const char *service_in, DATA_BLOB password, + char *dev, uint16 vuid, NTSTATUS *status) +{ + connection_struct *conn = NULL; + + conn = make_connection(service_in, password, dev, vuid, status); + + /* + * make_connection() does not change the directory for us any more + * so we have to do it as a separate step --jerry + */ + + if (vfs_ChDir(conn,conn->connectpath) != 0) { + DEBUG(0,("move_driver_to_download_area: Can't change directory to %s for [print$] (%s)\n", + conn->connectpath,strerror(errno))); + yield_connection(conn, lp_servicename(SNUM(conn))); + conn_free(conn); + return NULL; + } + + return conn; +} + /**************************************************************************** Make a connection to a service. * |