Changeset 693


Ignore:
Timestamp:
Mar 11, 2012, 6:19:02 PM (13 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.0 with CVE-2012-0870 security patch

Location:
branches/samba-3.0/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/build.cmd

    r459 r693  
    11/* Samba build script for eCS (OS/2) */
     2
     3/* version history */
     4/* version 0.1.0 from 09.04.2010 Herwig (first edition) */
     5/* version 0.2.2 from 08.09.2009 Herwig (a lot enhancements) */
     6/* version 0.3.0 from 17.08.2010 Silvan (redone a lot) */
     7/* version 0.3.1 from 20.08.2010 Silvan (added version.ecs check) */
     8/* version 0.3.2 from 08.07.2011 Silvan (pythonhome may be not set) */
     9/* version 0.3.3 from 05.11.2011 Herwig (add support for libc064) */
     10/* version 0.3.4 from 23.11.2011 Herwig (simplify libc switching) */
     11/* version 0.3.5 from 23.11.2011 Herwig (brand befor configure, if version.h is missing) */
     12
     13/* load the sysfuncs if not already loaded */
     14if (RxFuncQuery('SysLoadFuncs') = 1) then
     15do
     16    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
     17    call SysLoadFuncs;
     18end
     19
     20/* init the version string (don't forget to change) */
     21version = "0.3.5"
     22version_date = "23.11.2011"
    223
    324'@echo off'
    425parse upper arg cmdline
    526
     27say "Samba for eCS (OS/2) build script v"   || version || " from " || version_date
     28
    629/* No parameter or HELP -> display usage */
    730if pos("HELP", cmdline) > 0 | cmdline = "" then do
    8     say "Samba for eCS (OS/2) build script"
    931    say
    1032    say "Valid commands are:"
    1133    say "      HELP  - this page"
    12     say "      063   - link against libc063.dll"
    13     say "      064x  - link against libc064x.dll"
    1434    say "      CONF  - run configure"
    1535    say "      CLEAN - clean up and recompile everything"
     
    2040    say "      ZIP   - create ZIP archive"
    2141    say "      ALL   - do just everything"
     42    say "Deprecated options:"
     43    say "      064   - link against libc064.dll (default)"
     44    say "      064x  - link against libc064x.dll"
     45    say "      063   - link against libc063.dll"
    2246    say
    2347    exit 255
     
    3054
    3155options = 'build.options'
     56cacheFile = 'build.cache'
    3257
    3358/* defaults */
    3459make  = ""
    35 libc  = "064x"
    3660brand = "No"
    3761conf  = ""
     
    5276build_parms = ""
    5377
     78/* delete the following 7 lines to remove libc switching capability */
     79select
     80    when pos("064X", cmdline) > 0 then libc = "064X"
     81    when pos("063", cmdline) > 0 then  libc = "063"
     82    otherwise libc = "064"
     83end
     84address cmd "call "libc".cmd"
     85
    5486if pos("MAKE", cmdline) > 0 then do
    5587    make = "MAKE"
     
    6193    build_parms = build_parms||' 'make
    6294end
    63 if pos("064X", cmdline) > 0 then do
    64     libc = "064X"
    65     build_parms = build_parms||' 'libc   
    66 end
    67 if pos("063", cmdline) > 0 then do
    68     libc = "063"
    69     build_parms = build_parms||' 'libc   
    70 end
     95
    7196if pos("BRAND", cmdline) > 0 then do
    7297    Brand = "YES"
     
    78103end
    79104
     105ok = SysFileTree(".\include\version.h",versionh.,'FO')
     106
     107if versionh.0 = 0 & conf = "YES" then do
     108    svninfo = ".\svninfo"
     109    address cmd 'svn status -q -u | grep "^Status against revision:" | sed -e "s/Status against revision: *//">'svninfo
     110    revision = strip(translate(linein(svninfo)))
     111    ok = stream(svninfo,'c','close')
     112    call brand revision
     113end
     114
    80115/* start working */
    81 if libc = "063" then do
    82     address cmd "call 063.cmd"
    83 end
    84 else do
    85     address cmd "call 064x.cmd"
    86 end
    87 
    88116if conf = "YES" then do
    89         address cmd 'SETLOCAL'
    90         address cmd 'SET CFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
    91         address cmd 'SET CXXFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
    92         address cmd 'SET LDFLAGS=-s -Zsym -Zmap -Zbin-files -Zomf -Zexe -Zargs-wild -Zargs-resp'
    93         address cmd 'SET AR=emxomfar'
    94         address cmd 'SET LIBS=-lsocket -lsyslog'
     117    address cmd 'SETLOCAL'
     118/*  address cmd 'SET CFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
     119    address cmd 'SET CXXFLAGS=-g -Zomf -O1 -march=pentium -mtune=pentium4'
     120    address cmd 'SET LDFLAGS=-s -Zsym -Zmap -Zbin-files -Zomf -Zexe -Zargs-wild -Zargs-resp'
     121    address cmd 'SET AR=emxomfar'
     122    address cmd 'SET LIBS=-lsocket -lsyslog' */
    95123    /* disabled options:
    96         --enable-developer --enable-socket-wrapper
     124        --enable-developer --enable-socket-wrapper
    97125     */
    98     address cmd 'ksh ./configure --enable-pie=no --prefix=/samba --enable-static --disable-shared --disable-cups --disable-ldap --with-acl-support 2>&1 | tee configure.log'
    99         address cmd 'ENDLOCAL'
     126
     127/* we need to delete the cache file and redo it afterwards */
     128    ok = SysFileDelete(cacheFile);
     129
     130/* is cups env set */
     131    sEnvVar = EnvGet('CUPS');
     132    if sEnvVar <> '' then do
     133        call lineout cacheFile, "ac_cv_path_CUPS_CONFIG='" || sEnvVar || "'";
     134    end
     135
     136/* is python env set */
     137    sEnvVar = EnvGet('PYTHONHOME');
     138    if sEnvVar <> '' then do
     139        sPythonVersion = PythonVersion(sEnvVar);
     140        if sPythonVersion <> '-1' then do
     141            call lineout cacheFile, "ac_cv_path_PYTHON_CONFIG='" || sEnvVar || "/config/" || sPythonVersion || "'";
     142            call lineout cacheFile, "ac_cv_path_PYTHON='" || sEnvVar || "'";
     143        end
     144    end
     145
     146    ok = stream(cacheFile, 'c', 'close');
     147
     148/* run configure */
     149    address cmd 'ksh ./configure --enable-pie=no --prefix=/samba --disable-shared --with-acl-support --cache-file=build.cache 2>&1 | tee configure.log'
     150    address cmd 'ENDLOCAL'
    100151end
    101152
     
    103154    address cmd "make clean"
    104155end
    105            
     156
    106157if brand = "YES" then do
    107158    svninfo = ".\svninfo"
     
    115166    say build_parms
    116167    address cmd 'make 2>&1 | tee build.log'
    117 end   
     168end
    118169
    119170if pos("ZIP", cmdline) > 0 then do
     
    143194    VerFile = "VERSION.ECS"
    144195
     196    /* is the file available */
     197    ok = stream(VerFile, 'c', 'QUERY EXISTS')
     198    if ok = "" then do
     199        say "Please create a " || VerFile || " based on VERSION.EC_"
     200        exit 0
     201    end
     202
    145203    /* Samba Version file */
    146204    Version = "VERSION"
     
    153211        eCSVer.I = linein(VerFile)
    154212        if left(eCSVer.I,28) = "SAMBA_VERSION_VENDOR_SUFFIX=" then do
    155                     parse var eCSver.I . '='vendor_suffix
    156                     vendor_suffix = strip(vendor_suffix,,'"')
    157                     parse var vendor_suffix vendor suffix
     213            parse var eCSver.I . '='vendor_suffix
     214            vendor_suffix = strip(vendor_suffix,,'"')
     215            parse var vendor_suffix vendor suffix
    158216        end
    159217    end
     
    193251    verstring = suffix'-'Major'.'minor'.'release'.'revision'-'vendor'-'date('S')
    194252    say "Samba "verstring
    195 return
     253return
     254
     255
     256/**
     257 * Gets the value of sEnvVar.
     258 */
     259EnvGet: procedure
     260    parse arg sEnvVar
     261    if ((translate(sEnvVar) = 'BEGINLIBPATH') | (translate(sEnvVar) = 'ENDLIBPATH')) then
     262        return SysQueryExtLibPath(substr(sEnvVar, 1, 1));
     263return value(sEnvVar,, 'OS2ENVIRONMENT');
     264
     265/**
     266 * try to find the pythonversion
     267 */
     268PythonVersion: procedure
     269    parse arg pdir
     270
     271    ok = SysFileTree(pdir||"\python*.dll",pydll.,"FO")
     272    rc = -1
     273    if pydll.0 = 1 then do
     274        dllpur = filespec("N",pydll.1)
     275        parse var dllpur 'python' ver '.dll'
     276        if datatype(ver) <> "NUM" then do
     277            say "no valid python dll found!"
     278        end
     279        else do
     280            major = left(ver,1)
     281            minor = substr(ver,2,)
     282            verstring = "python"||major||"."||minor
     283            rc = verstring
     284        end
     285    end
     286    else do
     287        say "no dll found!"
     288    end
     289return rc
  • branches/samba-3.0/source/smbd/process.c

    r468 r693  
    10261026        int msg_type = CVAL(inbuf,0);
    10271027        uint16_t mid = SVAL(inbuf, smb_mid);
     1028        uint8_t wct = CVAL(inbuf, smb_wct);
    10281029
    10291030        chain_size = 0;
     
    10331034        if (msg_type != 0)
    10341035                return(reply_special(inbuf,outbuf)); 
     1036
     1037        /* Ensure we have at least wct words and 2 bytes of bcc. */
     1038        if (smb_size + wct*2 > size) {
     1039                DEBUG(0,("init_smb_request: invalid wct number %u (size %u)\n",
     1040                        (unsigned int)wct,
     1041                        (unsigned int)size));
     1042                exit_server_cleanly("Invalid SMB request");
     1043        }
     1044        /* Ensure bcc is correct. */
     1045        if (((uint8 *)smb_buf(inbuf)) + smb_buflen(inbuf) > inbuf + size) {
     1046                DEBUG(0,("init_smb_request: invalid bcc number %u "
     1047                        "(wct = %u, size %u)\n",
     1048                        (unsigned int)smb_buflen(inbuf),
     1049                        (unsigned int)wct,
     1050                        (unsigned int)size));
     1051                exit_server_cleanly("Invalid SMB request");
     1052        }
    10351053
    10361054        construct_reply_common(inbuf, outbuf);
     
    11621180        static int orig_size;
    11631181        int smb_com1, smb_com2 = CVAL(inbuf,smb_vwv0);
    1164         unsigned smb_off2 = SVAL(inbuf,smb_vwv1);
     1182        static unsigned smb_off2;
    11651183        char *inbuf2, *outbuf2;
    11661184        int outsize2;
     
    11811199                orig_outbuf = outbuf;
    11821200                orig_size = size;
    1183         }
     1201                smb_off2 = 0;
     1202        }
     1203
     1204        if (SVAL(inbuf,smb_vwv1) <= smb_off2) {
     1205                DEBUG(1, ("AndX offset not increasing\n"));
     1206                SCVAL(outbuf, smb_vwv0, 0xFF);
     1207                return outsize;
     1208        }
     1209        smb_off2 = SVAL(inbuf, smb_vwv1);
    11841210
    11851211        /* Validate smb_off2 */
Note: See TracChangeset for help on using the changeset viewer.