* We must return 0x2 as the majorversion for nt4 to upload drivers
authorGerald Carter <jerry@samba.org>
Fri, 11 Apr 2003 23:50:21 +0000 (23:50 +0000)
committerGerald Carter <jerry@samba.org>
Fri, 11 Apr 2003 23:50:21 +0000 (23:50 +0000)
* fix bug found by clobber_region()

source/rpc_server/srv_spoolss_nt.c
source/smbd/reply.c

index 424d7909d101c71a91030074ae49652fc1cbf356..4432b06fc7322bf383ccf2e7bce73bc7d65f936c 100644 (file)
@@ -2307,7 +2307,17 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *ctx, fstring value, uint
                *type = 0x4;
                if((*data = (uint8 *)talloc(ctx, 4*sizeof(uint8) )) == NULL)
                        return WERR_NOMEM;
-               SIVAL(*data, 0, 3);
+
+               /* Windows NT 4.0 seems to not allow uploading of drivers
+                  to a server that reports 0x3 as the MajorVersion.
+                  need to investigate more how Win2k gets around this .
+                  -- jerry */
+
+               if ( RA_WINNT == get_remote_arch() )
+                       SIVAL(*data, 0, 2);
+               else
+                       SIVAL(*data, 0, 3);
+               
                *needed = 0x4;
                return WERR_OK;
        }
index 0b710d6401088c16a6b2502e422c10153e1d6d79..1c7e23a20fccd6ebd9ec8ed91aab3d80b39e6fa9 100644 (file)
@@ -3042,20 +3042,22 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
  Resolve wildcards in a filename rename.
 ********************************************************************/
 
-static BOOL resolve_wildcards(char *name1,char *name2)
+static BOOL resolve_wildcards(const char *name1, char *name2)
 {
        fstring root1,root2;
        fstring ext1,ext2;
-       char *p,*p2;
+       char *p,*p2, *pname1, *pname2;
+       int available_space;
+       
 
-       name1 = strrchr_m(name1,'/');
-       name2 = strrchr_m(name2,'/');
+       pname1 = strrchr_m(name1,'/');
+       pname2 = strrchr_m(name2,'/');
 
-       if (!name1 || !name2)
+       if (!pname1 || !pname2)
                return(False);
   
-       fstrcpy(root1,name1);
-       fstrcpy(root2,name2);
+       fstrcpy(root1,pname1);
+       fstrcpy(root2,pname2);
        p = strrchr_m(root1,'.');
        if (p) {
                *p = 0;
@@ -3097,10 +3099,13 @@ static BOOL resolve_wildcards(char *name1,char *name2)
                        p++;
        }
 
-       pstrcpy(name2,root2);
+       available_space = sizeof(pstring) - PTR_DIFF(pname2, name2);
+       
+       StrnCpy(pname2, root2, available_space-1);
+       available_space -= strlen(root2);
        if (ext2[0]) {
-               pstrcat(name2,".");
-               pstrcat(name2,ext2);
+               strncat(pname2, ".", available_space-1);
+               strncat(pname2, ext2, available_space-2);
        }
 
        return(True);