From 74daef6018ac9d0354439693d1aca0a46c20e2a8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 11 Oct 2004 20:01:01 +0000 Subject: [PATCH] r2918: BUG 1907: fix getprinterdriverdir_1(). have to make sure we don't add unnecessary double slashes to the servername --- source/rpc_server/srv_spoolss_nt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c index fb498e73ada..a1db4c38548 100644 --- a/source/rpc_server/srv_spoolss_nt.c +++ b/source/rpc_server/srv_spoolss_nt.c @@ -7700,13 +7700,22 @@ static WERROR getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen pstring path; pstring long_archi; fstring servername; + char *pservername; const char *short_archi; DRIVER_DIRECTORY_1 *info=NULL; unistr2_to_ascii(servername, name, sizeof(servername)-1); unistr2_to_ascii(long_archi, uni_environment, sizeof(long_archi)-1); + + /* check for beginning double '\'s and that the server + long enough */ + + pservername = servername; + if ( *pservername == '\\' && strlen(servername)>2 ) { + pservername += 2; + } - if ( !is_myname_or_ipaddr( servername ) ) + if ( !is_myname_or_ipaddr( pservername ) ) return WERR_INVALID_PARAM; if (!(short_archi = get_short_archi(long_archi))) @@ -7715,7 +7724,7 @@ static WERROR getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen if((info=(DRIVER_DIRECTORY_1 *)malloc(sizeof(DRIVER_DIRECTORY_1))) == NULL) return WERR_NOMEM; - slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", servername, short_archi); + slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", pservername, short_archi); DEBUG(4,("printer driver directory: [%s]\n", path)); -- 2.11.4.GIT