Changeset 454


Ignore:
Timestamp:
Jun 4, 2010, 3:11:43 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: merged changes from 3.3

Location:
trunk/server/source3
Files:
8 added
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/Makefile.in

    r429 r454  
    391391          $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
    392392          lib/interface.o lib/pidfile.o \
    393           lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
     393          lib/system.o lib/os2ea.o lib/os2path.o lib/sendfile.o lib/recvfile.o lib/time.o \
    394394          lib/username.o \
    395395          ../libds/common/flag_mapping.o \
     
    17851785                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
    17861786
    1787 bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
     1787bin/ldbedit@EXEEXT@: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
    17881788        @echo Linking $@
    17891789        @$(CC) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) \
     
    17911791                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
    17921792
    1793 bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
     1793bin/ldbsearch@EXEEXT@: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
    17941794        @echo Linking $@
    17951795        @$(CC) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) \
     
    17971797                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
    17981798
    1799 bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
     1799bin/ldbadd@EXEEXT@: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
    18001800        @echo Linking $@
    18011801        @$(CC) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) \
     
    18031803                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
    18041804
    1805 bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
     1805bin/ldbmodify@EXEEXT@: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
    18061806        @echo Linking $@
    18071807        @$(CC) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) \
     
    18091809                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
    18101810
    1811 bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
     1811bin/ldbdel@EXEEXT@: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
    18121812        @echo Linking $@
    18131813        @$(CC) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) \
     
    18151815                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
    18161816
    1817 bin/ldbrename: $(BINARY_PREREQS) $(LDBRENAME_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
     1817bin/ldbrename@EXEEXT@: $(BINARY_PREREQS) $(LDBRENAME_OBJ) @BUILD_POPT@ $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
    18181818        @echo Linking $@
    18191819        @$(CC) $(FLAGS) -o $@ $(LDBRENAME_OBJ) $(DYNEXP) $(LDFLAGS) \
     
    18211821                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
    18221822
    1823 bin/versiontest: $(BINARY_PREREQS) lib/version_test.o $(VERSION_OBJ)
     1823bin/versiontest@EXEEXT@: $(BINARY_PREREQS) lib/version_test.o $(VERSION_OBJ)
    18241824        @echo Linking $@
    18251825        @$(CC) $(FLAGS) -o $@ $(VERSION_OBJ) lib/version_test.o
  • trunk/server/source3/dynconfig.c

    r414 r454  
    4141 **/
    4242
     43#ifndef __OS2__
    4344#define DEFINE_DYN_CONFIG_PARAM(name) \
    4445static char *dyn_##name; \
     
    6566        return (dyn_##name == NULL);\
    6667}
     68#else
     69#define DEFINE_DYN_CONFIG_PARAM(name) \
     70static char *dyn_##name; \
     71\
     72 const char *set_dyn_##name(const char *newpath) \
     73{\
     74        if (dyn_##name) {\
     75                SAFE_FREE(dyn_##name);\
     76        }\
     77        dyn_##name = SMB_STRDUP(newpath);\
     78        return dyn_##name;\
     79}\
     80\
     81 bool is_default_dyn_##name(void) \
     82{\
     83        return (dyn_##name == NULL);\
     84}
     85#endif
    6786
    6887DEFINE_DYN_CONFIG_PARAM(SBINDIR)
     
    83102DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
    84103DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
     104
     105#ifdef __OS2__
     106
     107/* Directory the binary was called from, same as getbindir() */
     108const char *get_dyn_SBINDIR(void)
     109{
     110        static char buffer[1024] = "";
     111        if (!*buffer)
     112        {
     113                char exedir[1024] = "";
     114                if (os2_GetExePath(exedir) != 0)
     115                {
     116                        snprintf(buffer, 260, "%s", SBINDIR);
     117                } else {
     118                        snprintf(buffer, 260, "%s", exedir);
     119                }
     120        }
     121
     122        if (dyn_SBINDIR == NULL) {
     123                return buffer;
     124        }
     125        return dyn_SBINDIR;
     126}
     127
     128/* Directory the binary was called from, same as getsbindir() */
     129const char *get_dyn_BINDIR(void)
     130{
     131        static char buffer[1024] = "";
     132        if (!*buffer)
     133        {
     134                char exedir[1024] = "";
     135                if (os2_GetExePath(exedir) != 0)
     136                {
     137                        snprintf(buffer, 260, "%s", BINDIR);
     138                } else {
     139                        snprintf(buffer, 260, "%s", exedir);
     140                }
     141        }
     142
     143        if (dyn_BINDIR == NULL) {
     144                return buffer;
     145        }
     146        return dyn_BINDIR;
     147}
     148
     149/* Directory holding the SWAT files */
     150const char *get_dyn_SWATDIR(void)
     151{
     152        static char buffer[1024] = "";
     153        if (!*buffer)
     154        {
     155                char exedir[1024] = "";
     156                if (os2_GetExePath(exedir) != 0)
     157                {
     158                        snprintf(buffer, 260, "%s", SWATDIR);
     159                } else {
     160                        snprintf(buffer, 260, "%s/%s", exedir,"swat");
     161                }
     162        }
     163
     164        if (dyn_SWATDIR == NULL) {
     165                return buffer;
     166        }
     167        return dyn_SWATDIR;
     168}
     169
     170/* Location of smb.conf file. */
     171const char *get_dyn_CONFIGFILE(void)
     172{
     173        static char buffer[1024] = "";
     174        if (!*buffer)
     175        {
     176                snprintf(buffer, 260, "%s/samba/smb.conf", getenv("ETC"));
     177        }
     178        /* Set UNIXROOT to x:\MPTN if UNIXROOT is undefined */
     179        if (getenv("UNIXROOT") == NULL) {
     180                static char unixroot[1024] = "";
     181                strncpy(unixroot,getenv("ETC"),strlen(getenv("ETC"))-4);
     182                setenv("UNIXROOT",unixroot,0);
     183        }
     184        /* Make sure TMPIR points to a proper value */
     185        static char tmpdir[1024] = "";
     186        if (getenv("TMPDIR") == NULL && getenv("TEMP") != NULL) {
     187                strncpy(tmpdir,getenv("TEMP"),strlen(getenv("TEMP")));
     188                setenv("TMPDIR",tmpdir,0);
     189        }
     190        if (getenv("TMPDIR") == NULL) {
     191                strncpy(tmpdir,getenv("ETC"),2);
     192                stpcpy(tmpdir,"/OS2/SYSTEM");
     193                setenv("TMPDIR",tmpdir,0);
     194        }
     195
     196        if (dyn_CONFIGFILE == NULL) {
     197                return buffer;
     198        }
     199        return dyn_CONFIGFILE;
     200}
     201
     202/** Log file directory. **/
     203const char *get_dyn_LOGFILEBASE(void)
     204{
     205        static char buffer[1024] = "";
     206        if (!*buffer)
     207        {
     208                snprintf(buffer, 260, "%s/samba/log", getenv("ETC"));
     209        }
     210        if (dyn_LOGFILEBASE == NULL) {
     211                return buffer;
     212        }
     213        return dyn_LOGFILEBASE;
     214}
     215
     216/** Statically configured LanMan hosts. **/
     217const char *get_dyn_LMHOSTSFILE(void)
     218{
     219        static char buffer[1024] = "";
     220        if (!*buffer)
     221        {
     222                snprintf(buffer, 260, "%s/samba/lmhosts", getenv("ETC"));
     223        }
     224        if (dyn_LMHOSTSFILE == NULL) {
     225                return buffer;
     226        }
     227        return dyn_LMHOSTSFILE;
     228}
     229
     230/* Directory holding the codepages */
     231const char *get_dyn_CODEPAGEDIR(void)
     232{
     233        static char buffer[1024] = "";
     234        if (!*buffer)
     235        {
     236                char exedir[1024] = "";
     237                if (os2_GetExePath(exedir) != 0)
     238                {
     239                        snprintf(buffer, 260, "%s", CODEPAGEDIR);
     240                } else {
     241                        snprintf(buffer, 260, "%s/%s", exedir, "codepages");
     242                }
     243        }
     244
     245        if (dyn_CODEPAGEDIR == NULL) {
     246                return buffer;
     247        }
     248        return dyn_CODEPAGEDIR;
     249}
     250
     251/* Directory holding the libs */
     252const char *get_dyn_LIBDIR(void)
     253{
     254        static char buffer[1024] = "";
     255        if (!*buffer)
     256        {
     257                char exedir[1024] = "";
     258                if (os2_GetExePath(exedir) != 0)
     259                {
     260                        snprintf(buffer, 260, "%s", LIBDIR);
     261                } else {
     262                        snprintf(buffer, 260, "%s/%s", exedir, "lib");
     263                }
     264        }
     265
     266        if (dyn_LIBDIR == NULL) {
     267                return buffer;
     268        }
     269        return dyn_LIBDIR;
     270}
     271
     272/* Directory holding the modules */
     273const char *get_dyn_MODULESDIR(void)
     274{
     275        static char buffer[1024] = "";
     276        if (!*buffer)
     277        {
     278                char exedir[1024] = "";
     279                if (os2_GetExePath(exedir) != 0)
     280                {
     281                        snprintf(buffer, 260, "%s", MODULESDIR);
     282                } else {
     283                        snprintf(buffer, 260, "%s/%s", exedir, "modules");
     284                }
     285        }
     286
     287        if (dyn_MODULESDIR == NULL) {
     288                return buffer;
     289        }
     290        return dyn_MODULESDIR;
     291}
     292
     293/* Directory holding lock files */
     294const char *get_dyn_LOCKDIR(void)
     295{
     296        static char buffer[1024] = "";
     297        if (!*buffer)
     298        {
     299                snprintf(buffer, 260, "%s/samba/lock", getenv("ETC"));
     300        }
     301        if (dyn_LOCKDIR == NULL) {
     302                return buffer;
     303        }
     304        return dyn_LOCKDIR;
     305}
     306
     307/* Directory holding the pid files */
     308const char *get_dyn_PIDDIR(void)
     309{
     310        static char buffer[1024] = "";
     311        if (!*buffer)
     312        {
     313                snprintf(buffer, 260, "%s/samba/pid", getenv("ETC"));
     314        }
     315        if (dyn_PIDDIR == NULL) {
     316                return buffer;
     317        }
     318        return dyn_PIDDIR;
     319}
     320
     321/* Location of smbpasswd */
     322const char *get_dyn_SMB_PASSWD_FILE(void)
     323{
     324        static char buffer[1024] = "";
     325        if (!*buffer)
     326        {
     327                snprintf(buffer, 260, "%s/samba/private/smbpasswd", getenv("ETC"));
     328        }
     329        if (dyn_SMB_PASSWD_FILE == NULL) {
     330                return buffer;
     331        }
     332        return dyn_SMB_PASSWD_FILE;
     333}
     334
     335/* Directory holding the private files */
     336const char *get_dyn_PRIVATE_DIR(void)
     337{
     338        static char buffer[1024] = "";
     339        if (!*buffer)
     340        {
     341                snprintf(buffer, 260, "%s/samba/private", getenv("ETC"));
     342        }
     343        if (dyn_PRIVATE_DIR == NULL) {
     344                return buffer;
     345        }
     346        return dyn_PRIVATE_DIR;
     347}
     348
     349/* @todo define NCALRPCDIR and SHLIBDIR eventually different */
     350
     351/* Directory holding the shared libs (same as libdir) */
     352const char *get_dyn_SHLIBEXT(void)
     353{
     354        static char buffer[1024] = "";
     355        if (!*buffer)
     356        {
     357                char exedir[1024] = "";
     358                if (os2_GetExePath(exedir) != 0)
     359                {
     360                        snprintf(buffer, 260, "%s", LIBDIR);
     361                } else {
     362                        snprintf(buffer, 260, "%s/%s", exedir, "lib");
     363                }
     364        }
     365
     366        if (dyn_SHLIBEXT == NULL) {
     367                return buffer;
     368        }
     369        return dyn_SHLIBEXT;
     370}
     371
     372/* Directory holding the NCALRPCDIR (whatever that is) */
     373const char *get_dyn_NCALRPCDIR(void)
     374{
     375        static char buffer[1024] = "";
     376        if (!*buffer)
     377        {
     378                char exedir[1024] = "";
     379                if (os2_GetExePath(exedir) != 0)
     380                {
     381                        snprintf(buffer, 260, "%s", NCALRPCDIR);
     382                } else {
     383                        snprintf(buffer, 260, "%s/%s", exedir, "lib");
     384                }
     385        }
     386
     387        if (dyn_NCALRPCDIR == NULL) {
     388                return buffer;
     389        }
     390        return dyn_NCALRPCDIR;
     391}
     392
     393#endif /* __OS2__ */
     394
     395/* In non-FHS mode, these should be configurable using 'lock dir =';
     396   but in FHS mode, they are their own directory.  Implement as wrapper
     397   functions so that everything can still be kept in dynconfig.c.
     398 */
     399
     400const char *get_dyn_STATEDIR(void)
     401{
     402#ifdef FHS_COMPATIBLE
     403        return STATEDIR;
     404#else
     405        return lp_lockdir();
     406#endif
     407}
     408
     409const char *get_dyn_CACHEDIR(void)
     410{
     411#ifdef FHS_COMPATIBLE
     412        return CACHEDIR;
     413#else
     414        return lp_lockdir();
     415#endif
     416}
  • trunk/server/source3/groupdb/mapping_ldb.c

    r414 r454  
    8181        /* force the permissions on the ldb to 0600 - this will fix
    8282           existing databases as well as new ones */
     83#ifndef __OS2__
    8384        if (chmod(db_path, 0600) != 0) {
    8485                goto failed;
    8586        }
     87#endif
    8688
    8789        if (!existed) {
  • trunk/server/source3/include/version.h

    r429 r454  
    44#define SAMBA_VERSION_RELEASE 2
    55#define SAMBA_VERSION_OFFICIAL_STRING "3.5.2"
     6#define SAMBA_VERSION_VENDOR_SUFFIX "eCS 1.2.0"
     7#define SAMBA_VERSION_VENDOR_PATCH 426
     8#define SAMBA_VERSION_VENDOR_PATCH_STRING "426"
    69#ifdef SAMBA_VERSION_VENDOR_FUNCTION
    710#  define SAMBA_VERSION_STRING SAMBA_VERSION_VENDOR_FUNCTION
  • trunk/server/source3/lib/charcnv.c

    r414 r454  
    18041804*/
    18051805
     1806/* @todo eventually port old code, but probably not necessary */
    18061807codepoint_t next_codepoint(const char *str, size_t *size)
    18071808{
  • trunk/server/source3/lib/fault.c

    r414 r454  
    5454        if (cont_fn) {
    5555                cont_fn(NULL);
     56#ifndef __OS2__ /* don't use the built in signal capture stuff - prefer native handling of errors */
    5657#ifdef SIGSEGV
    5758                CatchSignal(SIGSEGV,SIGNAL_CAST SIG_DFL);
     
    6263#ifdef SIGABRT
    6364                CatchSignal(SIGABRT,SIGNAL_CAST SIG_DFL);
     65#endif
    6466#endif
    6567                return; /* this should cause a core dump */
     
    8385        cont_fn = fn;
    8486
     87#ifndef __OS2__ /* don't use the built in signal capture stuff - prefer native handling of errors */
    8588#ifdef SIGSEGV
    8689        CatchSignal(SIGSEGV,SIGNAL_CAST sig_fault);
     
    9194#ifdef SIGABRT
    9295        CatchSignal(SIGABRT,SIGNAL_CAST sig_fault);
     96#endif
    9397#endif
    9498}
  • trunk/server/source3/lib/iconv.c

    r414 r454  
    128128}
    129129
     130#ifdef __OS2__
     131// i could have done a static variable w/o this function. but i feel it's nicer this way.
     132// the purpose of this function is to save the to_name to get the korean and japanese code set working
     133char * save_toname(char *toname, bool what)
     134{
     135   static char *to_name=NULL;
     136
     137   if ( what == 0 )
     138        to_name = SMB_STRDUP(toname);
     139
     140        return to_name;
     141}
     142#endif
     143
    130144#ifdef HAVE_NATIVE_ICONV
    131145/* if there was an error then reset the internal state,
     
    136150                        char **outbuf, size_t *outbytesleft)
    137151{
     152#ifdef __OS2__
     153        uint16 *outbuf_uc = ( uint16 * )*outbuf;
     154        char *to_name = save_toname(NULL, 1);
     155#endif
     156
    138157        size_t ret = iconv((iconv_t)cd,
    139158                           (void *)inbuf, inbytesleft,
     
    144163                errno = saved_errno;
    145164        }
     165#ifdef __OS2__
     166        /* Workaround for path separator on OS/2 */
     167        else
     168        {
     169                if( (strstr(to_name, "949") != NULL) ||     /* Korean CP */
     170                   (strstr(to_name, "932") != NULL) ||      /* Japanese CP */
     171                   (strstr(to_name, "942") != NULL) ||      /* Japanese CP */
     172                   (strstr(to_name, "943") != NULL) )       /* Japanese CP */
     173                {
     174                         while(( char * )outbuf_uc < *outbuf )
     175                        {
     176                            if( *outbuf_uc == 0x20a9 ||     /* Korean WON */
     177                                *outbuf_uc == 0x00a5 )      /* Japanese YEN */
     178                                *outbuf_uc = '\\';
     179
     180                            outbuf_uc++;
     181                        }
     182                }
     183        }
     184#endif
     185
    146186        return ret;
    147187}
     
    161201        char *bufp = cvtbuf;
    162202        size_t bufsize;
     203#ifdef __OS2__
     204        save_toname(cd->to_name, 0);
     205#endif
    163206
    164207        /* in many cases we can go direct */
  • trunk/server/source3/lib/ldb/common/ldb.c

    r414 r454  
    117117        ldb_connect_fn fn;
    118118
     119#ifndef __OS2__ //  on OS2 we have a semicolon at the second character if w/o backend called
    119120        if (strchr(url, ':') != NULL) {
     121#else
     122        if (url[1] != ':'  &&  strchr(url, ':') != NULL) {
     123#endif
    120124                backend = talloc_strndup(ldb, url, strchr(url, ':')-url);
    121125        } else {
  • trunk/server/source3/lib/ldb/ldb_tdb/ldb_tdb.c

    r414 r454  
    10121012
    10131013        /* parse the url */
     1014#ifndef __OS2__ //  on OS2 we have a semicolon at the second character if w/o backend called
    10141015        if (strchr(url, ':')) {
     1016#else
     1017        if (url[1] != ':'  &&  strchr(url, ':') != NULL) {
     1018#endif
    10151019                if (strncmp(url, "tdb://", 6) != 0) {
    10161020                        ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid tdb URL '%s'", url);
  • trunk/server/source3/lib/pidfile.c

    r414 r454  
    6868        }
    6969
     70#ifndef __OS2__ // if we lock the file, we won't be able to read it later on OS/2
    7071        if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_RDLCK)) {
    7172                /* we could get the lock - it can't be a Samba process */
    7273                goto noproc;
    7374        }
     75#endif
    7476
    7577        SAFE_FREE(pidFile);
     
    9597        /* Add a suffix to the program name if this is a process with a
    9698         * none default configuration file name. */
     99
     100        /* On OS/2, CONFIGFILE will always be different to dyn_CONFIGFILE
     101           as dyn_CONFIGFILE dynamically looks up the system ETC directory */   
     102#ifndef __OS2__
     103
    97104        if (strcmp( CONFIGFILE, get_dyn_CONFIGFILE()) == 0) {
    98105                name = SMB_STRDUP(program_name);
     
    111118                }
    112119        }
     120#else
     121        name = SMB_STRDUP(program_name);
     122#endif
    113123
    114124        if (asprintf(&pidFile_name, "%s/%s.pid", lp_piddir(), name) == -1) {
     
    144154                exit(1);
    145155        }
     156
    146157        /* Leave pid file open & locked for the duration... */
    147158        SAFE_FREE(name);
     159#ifdef __OS2__ // If we leave the file open & locked on OS/2 - we can't read it, so close the fd
     160        close(fd);
     161#endif
    148162}
    149163
  • trunk/server/source3/lib/readline.c

    r414 r454  
    102102                        return ret;
    103103                }
     104#ifdef __OS2__
     105#include <conio.h>
     106                {
     107                        char * cp = line;
     108                        char c;
     109                        int flag = 1;
     110                        while (flag && cp < line + sizeof(line) - 1)
     111                        {
     112                                c = getch();
     113                                switch (c)
     114                                {
     115                                        case 8:
     116                                        {
     117                                                if (cp > line)
     118                                                {
     119                                                        cp--;
     120                                                        putchar(8);
     121                                                        putchar(32);
     122                                                        putchar(8);
     123                                                }
     124                                        } break;
     125                                        case 0: break;
     126                                        case 10: // generally should not be
     127                                        case 13:
     128                                        {
     129                                                flag = 0;
     130                                        } break;
     131                                        case 27:
     132                                        {
     133                                                for (; cp > line; cp--)
     134                                                {
     135                                                        putchar(8);
     136                                                        putchar(32);
     137                                                        putchar(8);
     138                                                }
     139                                        } break;
     140                                        default:
     141                                        {
     142                                                *cp++ = c;
     143                                                putchar(c);
     144                                        }
     145                                }
     146                        }
     147                        *cp = 0;
     148                        printf("\n");
     149                        return line;
     150                }
     151#endif /* __OS2__ */
     152
    104153                if (callback) {
    105154                        callback();
  • trunk/server/source3/lib/select.c

    r414 r454  
    6363
    6464        if (initialised != sys_getpid()) {
     65#ifndef __OS2__
    6566                if (pipe(select_pipe) == -1)
     67#else
     68                if (socketpair(AF_UNIX, SOCK_STREAM,0, select_pipe) == -1)
     69#endif
    6670                {
    6771                        DEBUG(0, ("sys_select: pipe failed (%s)\n",
  • trunk/server/source3/lib/smbrun.c

    r414 r454  
    8383        }
    8484
     85#ifdef __OS2__
     86                char buf[8192];
     87                int     n, w;
     88                const char *newcmd = sanitize ? escape_shell_string(cmd) : cmd;
     89                if (!newcmd) {
     90                        close(*outfd);
     91                        *outfd = -1;
     92                        return(82);
     93                }
     94                // execute script and capture stdout
     95                FILE* pipe = popen( newcmd, "rb");
     96                if (pipe) {
     97                        // get stdout from pipe
     98                        while( !feof( pipe)) {
     99                                n = fread( buf, 1, 8192, pipe);
     100                                // write to file if required
     101                                if (n>0 && outfd!=NULL)
     102                                        w = write( *outfd, buf, n);
     103                        }
     104                        // close and return status
     105                        pclose( pipe);
     106                        return 0;
     107                }
     108                // error, close files
     109                close(*outfd);
     110                *outfd = -1;
     111                return 83;
     112#else
    85113        /* in this method we will exec /bin/sh with the correct
    86114           arguments, after first setting stdout to point at the file */
     
    202230        exit(83);
    203231        return 1;
     232#endif
    204233}
    205234
  • trunk/server/source3/lib/system.c

    r429 r454  
    641641#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64)
    642642        return ftruncate64(fd, offset);
     643#elif defined(__OS2__)
     644        return os2_ftruncate(fd, offset);
    643645#else
    644646        return ftruncate(fd, offset);
     
    15711573        }
    15721574        return ret;
     1575#elif defined(__OS2__)
     1576        return unigetxattr(path, 0, name, value, size);
    15731577#else
    15741578        errno = ENOSYS;
     
    16221626        }
    16231627        return ret;
     1628#elif defined(__OS2__)
     1629        return unigetxattr(path, 0, name, value, size);
    16241630#else
    16251631        errno = ENOSYS;
     
    16751681        }
    16761682        return ret;
     1683#elif defined(__OS2__)
     1684        return unigetxattr(0, filedes, name, value, size);
    16771685#else
    16781686        errno = ENOSYS;
     
    18671875        }
    18681876        return ret;
     1877#elif defined(__OS2__)
     1878        return unilistxattr(path, 0, list, size);
    18691879#else
    18701880        errno = ENOSYS;
     
    18961906        }
    18971907        return ret;
     1908#elif defined(__OS2__)
     1909        return unilistxattr(path, 0, list, size);
    18981910#else
    18991911        errno = ENOSYS;
     
    19271939        }
    19281940        return ret;
     1941#elif defined(__OS2__)
     1942        return unilistxattr(0, filedes, list, size);
    19291943#else
    19301944        errno = ENOSYS;
     
    19661980        }
    19671981        return ret;
     1982#elif defined(__OS2__)
     1983        return uniremovexattr (path, 0, name);
    19681984#else
    19691985        errno = ENOSYS;
     
    20032019        }
    20042020        return ret;
     2021#elif defined(__OS2__)
     2022        return uniremovexattr (path, 0, name);
    20052023#else
    20062024        errno = ENOSYS;
     
    20422060        }
    20432061        return ret;
     2062#elif defined(__OS2__)
     2063        return uniremovexattr (0, filedes, name);
    20442064#else
    20452065        errno = ENOSYS;
     
    21072127        }
    21082128        return ret;
     2129#elif defined(__OS2__)
     2130        return unisetxattr (path, 0, name, value, size, flags);
    21092131#else
    21102132        errno = ENOSYS;
     
    21712193        }
    21722194        return ret;
     2195#elif defined(__OS2__)
     2196        return unisetxattr (path, 0, name, value, size, flags);
    21732197#else
    21742198        errno = ENOSYS;
     
    22362260        }
    22372261        return ret;
     2262#elif defined(__OS2__)
     2263        return unisetxattr (0, filedes, name, value, size, flags);
    22382264#else
    22392265        errno = ENOSYS;
  • trunk/server/source3/lib/system_smbd.c

    r414 r454  
    4141                                  int *grpcnt)
    4242{
     43#ifndef __OS2__groups
    4344        gid_t *gids_saved;
    4445        int ret, ngrp_saved, num_gids;
     
    112113        free(gids_saved);
    113114        return ret;
     115#else
     116        *grpcnt = 0;
     117        return 0;
     118#endif
    114119}
    115120#endif
  • trunk/server/source3/lib/util.c

    r414 r454  
    20272027int set_maxfiles(int requested_max)
    20282028{
    2029 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
     2029#if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) && !defined(__OS2__))
    20302030        struct rlimit rlp;
    20312031        int saved_current_limit;
  • trunk/server/source3/lib/util_sec.c

    r414 r454  
    9393static void assert_uid(uid_t ruid, uid_t euid)
    9494{
     95#ifndef __OS2__
    9596        if ((euid != (uid_t)-1 && geteuid() != euid) ||
    9697            (ruid != (uid_t)-1 && getuid() != ruid)) {
     
    103104                }
    104105        }
     106#endif
    105107}
    106108
     
    110112static void assert_gid(gid_t rgid, gid_t egid)
    111113{
     114#ifndef __OS2__
    112115        if ((egid != (gid_t)-1 && getegid() != egid) ||
    113116            (rgid != (gid_t)-1 && getgid() != rgid)) {
     
    121124                }
    122125        }
     126#endif
    123127}
    124128
  • trunk/server/source3/lib/util_sock.c

    r414 r454  
    16791679        /* Create the socket directory or reuse the existing one */
    16801680
     1681#ifndef __OS2__
    16811682        if (lstat(socket_dir, &st) == -1) {
    16821683                if (errno == ENOENT) {
     
    17071708                }
    17081709        }
     1710#endif
    17091711
    17101712        /* Create the socket file */
     
    17181720        }
    17191721
     1722#ifdef __OS2__
     1723        if (asprintf(&path, "\\socket\\samba\\%s\\%s", socket_dir, socket_name) == -1) {
     1724#else       
    17201725        if (asprintf(&path, "%s/%s", socket_dir, socket_name) == -1) {
     1726#endif
    17211727                goto out_close;
    17221728        }
  • trunk/server/source3/lib/util_str.c

    r414 r454  
    22642264*******************************************************************/
    22652265
     2266#ifdef __OS2__
     2267#define INCLUDE_LIST "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_/ \t.,:"
     2268#else
    22662269#define INCLUDE_LIST "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_/ \t.,"
     2270#endif
    22672271#define INSIDE_DQUOTE_LIST "$`\n\"\\"
    22682272
  • trunk/server/source3/libaddns/dns.h

    r414 r454  
    4141#include <fcntl.h>
    4242#include <time.h>
     43#ifndef __OS2__
    4344#include <string.h>
     45#endif
    4446#include <errno.h>
    4547#include <netdb.h>
  • trunk/server/source3/libaddns/dnserr.h

    r414 r454  
    3636/* Setup the DNS_ERROR typedef.  Technique takes from nt_status.h */
    3737
    38 #if defined(HAVE_IMMEDIATE_STRUCTURES)
     38#if defined(HAVE_IMMEDIATE_STRUCTURES) && !defined(__OS2__)
    3939typedef struct {uint32 v;} DNS_ERROR;
    4040#define ERROR_DNS(x) ((DNS_ERROR) { x })
  • trunk/server/source3/libsmb/clientgen.c

    r429 r454  
    567567        bool mandatory_signing = false;
    568568
     569#ifndef __OS2__
    569570        /* Check the effective uid - make sure we are not setuid */
    570571        if (is_setuid_root()) {
     
    572573                return NULL;
    573574        }
     575#endif
    574576
    575577        cli = TALLOC_ZERO_P(NULL, struct cli_state);
  • trunk/server/source3/libsmb/clifile.c

    r414 r454  
    43604360                        &setup, 1, 0,   /* setup, length, max */
    43614361                        param, param_len, 10, /* param, length, max */
     4362#ifdef __OS2__
     4363                        NULL, data_len, CLI_BUFFER_SIZE /* data, length, max */
     4364#else
    43624365                        NULL, data_len, cli->max_xmit /* data, length, max */
     4366#endif
    43634367                                )) {
    43644368                return False;
     
    45024506        memset(param, 0, 6);
    45034507        SSVAL(param,0,fnum);
     4508#ifndef __OS2__
    45044509        SSVAL(param,2,SMB_INFO_SET_EA);
     4510#else
     4511        SSVAL(param,2,SMB_INFO_QUERY_ALL_EAS);
     4512#endif
    45054513
    45064514        return cli_get_ea_list(cli, setup, param, 6, ctx, pnum_eas, pea_list);
  • trunk/server/source3/locking/posix.c

    r414 r454  
    252252        ret = SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, &pid);
    253253
     254#ifndef __OS2__ /* file locks currently fail with OS/2's libc */
    254255        if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno ==  EINVAL))) {
    255256
     
    277278                }
    278279        }
     280#endif
    279281
    280282        DEBUG(8,("posix_fcntl_getlock: Lock query call %s\n", ret ? "successful" : "failed"));
  • trunk/server/source3/nmbd/asyncdns.c

    r414 r454  
    141141        CatchChild();
    142142
     143#ifdef __OS2__ // cant use pipes here, because select() from innotek lib does work only for sockets.
     144        if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd1) < 0)
     145        {
     146                DEBUG(0,("can't create asyncdns socketpair1 %d\n", errno));
     147                return;         
     148        }
     149        if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd2) < 0)
     150        {
     151                DEBUG(0,("can't create asyncdns socketpair2 %d\n", errno));
     152                close(fd1[0]);
     153                close(fd1[1]);
     154                return;         
     155        }
     156        DEBUG(9,("!!!!!!PIPES %d %d %d %d\n", fd1[0], fd1[1], fd2[0], fd2[1]));
     157#else
    143158        if (pipe(fd1) || pipe(fd2)) {
    144159                DEBUG(0,("can't create asyncdns pipes\n"));
    145160                return;
    146161        }
     162#endif
    147163
    148164        child_pid = sys_fork();
  • trunk/server/source3/nmbd/nmbd.c

    r414 r454  
    3030extern bool global_in_nmbd;
    3131
     32#ifdef __OS2__
     33extern int global_Sem32Add;
     34#endif
     35
    3236extern bool override_logfile;
    3337
     
    384388                reload_nmbd_services( True );
    385389        }
     390
     391#ifdef __OS2__
     392        /* restore the logfile to log.nmbd if !override_logfile */
     393        if (!override_logfile) {
     394                char *lfile = NULL;
     395                if (asprintf(&lfile, "%s/log.nmbd", get_dyn_LOGFILEBASE()) < 0) {
     396                        exit(1);
     397                }
     398                lp_set_logfile(lfile);
     399                SAFE_FREE(lfile);
     400        }
     401#endif
    386402
    387403        return(ret);
     
    776792        TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
    777793
     794#ifdef __OS2__
     795        global_Sem32Add = 1;
     796#endif
     797
    778798        load_case_tables();
    779799
  • trunk/server/source3/nmbd/nmbd_serverlistdb.c

    r414 r454  
    331331                return;
    332332        }
     333#ifndef __OS2__
    333334        fnamenew = talloc_asprintf(ctx, "%s.",
     335#else
     336        fnamenew = talloc_asprintf(ctx, "%s.tmp",
     337#endif
    334338                                fname);
    335339        if (!fnamenew) {
     
    418422
    419423        x_fclose(fp);
     424#ifdef __OS2__
     425        close(fp);
     426#endif
    420427        unlink(fname);
    421428        chmod(fnamenew,0644);
  • trunk/server/source3/nmbd/nmbd_winsserver.c

    r414 r454  
    23892389
    23902390        x_fclose(fp);
     2391#ifdef __OS2__
     2392        close(fp);
     2393#endif
    23912394        chmod(fnamenew,0644);
    23922395        unlink(fname);
  • trunk/server/source3/param/loadparm.c

    r414 r454  
    46654665                case PRINT_AIX:
    46664666                case PRINT_LPRNT:
     4667#ifndef __OS2__
    46674668                case PRINT_LPROS2:
     4669#endif
    46684670                        string_set(&pService->szLpqcommand, "lpq -P'%p'");
    46694671                        string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
    46704672                        string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
    46714673                        break;
     4674#ifdef __OS2__
     4675                case PRINT_LPROS2:
     4676                        string_set(&pService->szLpqcommand, "lpq.exe -s %i -p %p");
     4677                        string_set(&pService->szLprmcommand, "lprm.exe -s %i -p %p %j");
     4678                        string_set(&pService->szPrintcommand, "lpr.exe -b -s %i -p %p %s & cmd.exe /c del %s");
     4679                        break;
     4680#endif         
    46724681
    46734682                case PRINT_LPRNG:
     
    49384947        string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
    49394948
     4949#ifdef __OS2__
     4950        /* search the system codepage and set OS2CodePageStr */
     4951        unsigned long _System DosQueryCp (unsigned long ulLength, unsigned long *pCodePageList, unsigned long *pDataLength);
     4952        char *OS2CodePageStr=NULL;
     4953        unsigned long OS2CodePage[3];
     4954        unsigned long OS2CodePageLen;
     4955        if ( DosQueryCp( sizeof(OS2CodePage), OS2CodePage, &OS2CodePageLen ) )
     4956           asprintf(&OS2CodePageStr, "SYSTEM");
     4957          else
     4958           asprintf(&OS2CodePageStr, "IBM-%u", OS2CodePage[0]);
     4959#endif
     4960#ifndef __OS2__
    49404961        /* using UTF8 by default allows us to support all chars */
    49414962        string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
     4963#else
     4964        /* On OS/2, using UTF8 causes problems with display of foreign
     4965           characters - default to system codepage */
     4966        string_set(&Globals.unix_charset, OS2CodePageStr);
     4967#endif
    49424968
    49434969#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
    49444970        /* If the system supports nl_langinfo(), try to grab the value
    49454971           from the user's locale */
     4972#ifndef __OS2__
    49464973        string_set(&Globals.display_charset, "LOCALE");
     4974#else
     4975        /* On OS/2, using UTF8 causes problems with display of foreign
     4976           characters - default to system codepage */
     4977        string_set(&Globals.display_charset, OS2CodePageStr);
     4978#endif 
     4979
    49474980#else
    49484981        string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
    49494982#endif
    49504983
     4984#ifndef __OS2__
    49514985        /* Use codepage 850 as a default for the dos character set */
    49524986        string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
     4987#else
     4988        /* On OS/2, using UTF8 causes problems with display of foreign
     4989           characters - default to system codepage */
     4990        string_set(&Globals.dos_charset, OS2CodePageStr);
     4991#endif
    49534992
    49544993        /*
  • trunk/server/source3/passdb/pdb_smbpasswd.c

    r414 r454  
    277277                         */
    278278
     279#ifndef __OS2__
    279280                        if (sys_stat(pfile, &sbuf1, false) != 0) {
    280281                                DEBUG(0, ("startsmbfilepwent_internal: unable to stat file %s. \
     
    294295
    295296                        if( sbuf1.st_ex_ino == sbuf2.st_ex_ino) {
     297#else
    296298                                /* No race. */
     299                        {
     300#endif
    297301                                break;
    298302                        }
     
    315319        setvbuf(fp, (char *)NULL, _IOFBF, 1024);
    316320
     321#ifndef __OS2__
    317322        /* Make sure it is only rw by the owner */
    318323#ifdef HAVE_FCHMOD
     
    327332                return NULL;
    328333        }
     334#endif
    329335
    330336        /* We have a lock on the file. */
     
    11681174         * Do an atomic rename - then release the locks.
    11691175         */
     1176#ifdef __OS2__
     1177        endsmbfilepwent(fp, &smbpasswd_state->pw_file_lock_depth);
     1178        endsmbfilepwent(fp_write,&pfile2_lockdepth);
     1179#endif
    11701180
    11711181        if(rename(pfile2,pfile) != 0) {
     
    11731183        }
    11741184
     1185#ifndef __OS2__
    11751186        endsmbfilepwent(fp, &smbpasswd_state->pw_file_lock_depth);
    11761187        endsmbfilepwent(fp_write,&pfile2_lockdepth);
     1188#endif
    11771189        return True;
    11781190}
  • trunk/server/source3/printing/printing.c

    r414 r454  
    14311431        DEBUG(3,("start_background_queue: Starting background LPQ thread\n"));
    14321432
     1433#ifndef __OS2__
    14331434        if (pipe(pause_pipe) == -1) {
     1435#else   // on OS2 we have no select() on pipes, so we use socketpair() instead
     1436        if (socketpair(AF_UNIX, SOCK_STREAM,0, pause_pipe) < 0) {
     1437#endif
    14341438                DEBUG(5,("start_background_queue: cannot create pipe. %s\n", strerror(errno) ));
    14351439                exit(1);
  • trunk/server/source3/rpc_server/srv_srvsvc_nt.c

    r414 r454  
    179179
    180180        if ( strcmp( fname, "." ) == 0 ) {
     181#ifndef __OS2__
    181182                fullpath = talloc_asprintf(fenum->ctx, "C:%s", sharepath );
     183#else
     184                fullpath = talloc_asprintf(fenum->ctx, "%s%s",
     185                                                                (strchr( sharepath,':')) ? "" : "C:", sharepath );
     186#endif
    182187        } else {
     188#ifndef __OS2__
    183189                fullpath = talloc_asprintf(fenum->ctx, "C:%s/%s",
    184190                                sharepath, fname );
     191#else
     192                fullpath = talloc_asprintf(fenum->ctx, "%s%s/%s",
     193                                (strchr( sharepath,':')) ? "" : "C:", sharepath, fname );
     194#endif
    185195        }
    186196        if (!fullpath) {
     
    294304                        "", remark);
    295305        }
     306#ifdef __OS2__
     307        if (strchr( lp_pathname(snum), ':'))
     308                path = talloc_asprintf(p->mem_ctx,"%s", lp_pathname(snum));
     309        else
     310#endif 
     311
    296312        path = talloc_asprintf(p->mem_ctx,
    297313                        "C:%s", lp_pathname(snum));
     
    386402                        "", remark);
    387403        }
     404#ifdef __OS2__
     405        if (strchr( lp_pathname(snum), ':'))
     406                path = talloc_asprintf(ctx, "%s", lp_pathname(snum));
     407        else
     408#endif 
    388409        path = talloc_asprintf(ctx, "C:%s", lp_pathname(snum));
    389410        if (path) {
     
    14891510        }
    14901511
     1512#ifdef __OS2__
     1513        /* Only absolute paths allowed. */
     1514        if (strlen(ptr) < 2 || ptr[1] != ':')
     1515                return NULL;
     1516#else
    14911517        /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
    14921518        if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
     
    14961522        if (*ptr != '/')
    14971523                return NULL;
     1524#endif
    14981525
    14991526        return ptr;
     
    23382365***********************************************************************************/
    23392366
     2367#ifndef __OS2__
    23402368static const char *server_disks[] = {"C:"};
     2369#else // YD we can use a better implementation (real time scan or above idea)
     2370static const char *server_disks[] = {"C:","D:","E:","F:","G:","H:","I:","J:","K:","L:","M:","N:","O:",
     2371                                            "P:","Q:","R:","S:","T:","U:","V:","W:","X:","Y:","Z:"};
     2372#endif
    23412373
    23422374static uint32 get_server_disk_count(void)
  • trunk/server/source3/smbd/dosmode.c

    r414 r454  
    180180        if (ro_opts == MAP_READONLY_YES) {
    181181                /* Original Samba method - map inverse of user "w" bit. */
     182#ifndef __OS2__
    182183                if ((smb_fname->st.st_ex_mode & S_IWUSR) == 0) {
     184#else
     185                if (os2_isattribute(smb_fname->base_name, aRONLY) == 0) {
     186#endif
    183187                        result |= aRONLY;
    184188                }
     
    190194        } /* Else never set the readonly bit. */
    191195
     196#ifndef __OS2__
    192197        if (MAP_ARCHIVE(conn) && ((smb_fname->st.st_ex_mode & S_IXUSR) != 0))
     198#else
     199        if (os2_isattribute(smb_fname->base_name, aARCH) == 0)
     200#endif
    193201                result |= aARCH;
    194202
     203#ifndef __OS2__
    195204        if (MAP_SYSTEM(conn) && ((smb_fname->st.st_ex_mode & S_IXGRP) != 0))
     205#else
     206        if (os2_isattribute(smb_fname->base_name, aSYSTEM) == 0)
     207#endif
    196208                result |= aSYSTEM;
    197209
     210#ifndef __OS2__
    198211        if (MAP_HIDDEN(conn) && ((smb_fname->st.st_ex_mode & S_IXOTH) != 0))
     212#else
     213        if (os2_isattribute(smb_fname->base_name, aHIDDEN) == 0)
     214#endif
    199215                result |= aHIDDEN;   
    200216
     
    249265#else
    250266                                ) {
     267#endif
     268
     269#ifdef __OS2__ //on os2 no error in case of ./.. and errno 2
     270        if ((strncmp(smb_fname->base_name, "./..", 4) !=0) || (errno !=2))
    251271#endif
    252272                        DEBUG(1,("get_ea_dos_attributes: Cannot get attribute "
  • trunk/server/source3/smbd/password.c

    r414 r454  
    219219                return -1;
    220220        }
     221
     222#ifdef __OS2__
     223                        /* On OS/2 we use drive letters which have a colon.  This is also the field
     224                           separator in master.passwd, so we use a $ instead of a colon for the drive
     225                           separator, ie e$/user instead of e:/user.  This code simply exchanges any $
     226                           for a : in the user's homedir */
     227                        if (pwd->pw_dir[1] == '$')
     228                                        pwd->pw_dir[1] = ':';
     229#endif
    221230
    222231        DEBUG(3, ("Adding homes service for user '%s' using home directory: "
  • trunk/server/source3/smbd/reply.c

    r429 r454  
    56525652        bool dst_exists, old_is_stream, new_is_stream;
    56535653
     5654/* borrowed from 3.3 source patch by Apple */
     5655#ifdef __OS2__
     5656        bool check_dest_exist = False;
     5657#else
     5658        bool check_dest_exist = True;
     5659#endif
     5660
    56545661        status = check_name(conn, smb_fname_dst_in->base_name);
    56555662        if (!NT_STATUS_IS_OK(status)) {
     
    57895796        dst_exists = SMB_VFS_STAT(conn, smb_fname_dst) == 0;
    57905797
    5791         if(!replace_if_exists && dst_exists) {
     5798        if(check_dest_exist && !replace_if_exists && dst_exists) {
    57925799                DEBUG(3, ("rename_internals_fsp: dest exists doing rename "
    57935800                          "%s -> %s\n", smb_fname_str_dbg(fsp->fsp_name),
  • trunk/server/source3/smbd/server.c

    r429 r454  
    11171117        reopen_logs();
    11181118
     1119#ifdef __OS2__
     1120        unsigned long  _System DosSetPriority (unsigned long  ulScope, unsigned long  ulClass, long lDelta, unsigned long ulID);
     1121        int rc;
     1122        rc = DosSetPriority(
     1123                0,                      /* Scope: only one process */
     1124                4,             /* set to PRTYC_FOREGROUNDSERVER */
     1125                0,                      /* set delta - was 0 */
     1126                0);                     /* Assume current process */
     1127        DEBUG(0,( "Server priority set to PRTYC_FOREGROUNDSERVER\n"));
     1128#endif
     1129
    11191130        DEBUG(0,("smbd version %s started.\n", samba_version_string()));
    11201131        DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
  • trunk/server/source3/smbd/service.c

    r429 r454  
    6868        d = destname;
    6969
     70#ifndef __OS2__
    7071        *d++ = '/'; /* Always start with root. */
    7172
     
    159160                *(d-1) = '\0';
    160161        }
     162#else
     163        /* Assume OS/2 users are smart enough to put a correct path in smb.conf, and simply copy the string */
     164        safe_strcpy(destname, connectpath, strlen(connectpath));
     165#endif 
    161166
    162167        DEBUG(10,("set_conn_connectpath: service %s, connectpath = %s\n",
  • trunk/server/source3/smbd/sesssetup.c

    r429 r454  
    7575        result = 0;
    7676
     77#ifndef __OS2__
    7778        tmp = message_push_string(outbuf, "Unix", STR_TERMINATE);
     79#else
     80        tmp = message_push_string(outbuf, "eCS (OS/2)", STR_TERMINATE);
     81#endif
    7882
    7983        if (tmp == -1) return -1;
  • trunk/server/source3/smbd/trans2.c

    r414 r454  
    128128
    129129        pea->flags = 0;
     130#ifndef __OS2__
    130131        if (strnequal(ea_name, "user.", 5)) {
    131132                pea->name = talloc_strdup(mem_ctx, &ea_name[5]);
    132133        } else {
     134#else
     135                {
     136#endif
    133137                pea->name = talloc_strdup(mem_ctx, ea_name);
    134138        }
     
    287291                fstring dos_ea_name;
    288292
     293#ifndef __OS2__
    289294                if (strnequal(names[i], "system.", 7)
    290295                    || samba_private_attr_name(names[i]))
     296#else
     297                if (samba_private_attr_name(names[i]))
     298#endif
    291299                        continue;
    292300
     
    492500                fstring unix_ea_name;
    493501
     502#ifdef __OS2__
     503                /* All EA's must start with user - except on OS/2 */
     504                fstrcpy(unix_ea_name, ea_list->ea.name);
     505#else
    494506                fstrcpy(unix_ea_name, "user."); /* All EA's must start with user. */
    495507                fstrcat(unix_ea_name, ea_list->ea.name);
     508#endif
    496509
    497510                canonicalize_ea_name(conn, fsp, fname, unix_ea_name);
     
    54545467        }
    54555468
     5469#ifdef __OS2__
     5470        /* YD ticket#60, the file is opened, we cannot write to it,
     5471         * so we can return immediately (see above for more comments).
     5472         */
     5473        else {
     5474#endif
     5475
    54565476        DEBUG(10,("smb_set_file_time: setting utimes to modified values.\n"));
    54575477
     
    54635483                return map_nt_error_from_unix(errno);
    54645484        }
     5485#ifdef __OS2__
     5486        }
     5487#endif
    54655488
    54665489        notify_fname(conn, NOTIFY_ACTION_MODIFIED, action,
  • trunk/server/source3/smbd/vfs.c

    r414 r454  
    716716                return(0);
    717717
     718#ifdef __OS2__
     719        if ((*path == '/' || *path == '\\' || (*path && path[1] == ':')) && strcsequal(LastDir,path))
     720#else
    718721        if (*path == '/' && strcsequal(LastDir,path))
     722#endif
    719723                return(0);
    720724
     
    938942                  resolved_name));
    939943
     944#ifdef __OS2__
     945        if (*resolved_name != '/' && *resolved_name != '\\' && (strlen(resolved_name) <= 1 || resolved_name[1] != ':')) {
     946#else
    940947        if (*resolved_name != '/') {
     948#endif
    941949                DEBUG(0,("check_reduced_name: realpath doesn't return "
    942950                         "absolute paths !\n"));
  • trunk/server/source3/torture/torture.c

    r429 r454  
    50265026        printf("num_eas = %d\n", (int)num_eas);
    50275027
     5028#ifdef __OS2__ // add libc UNIX emulation EAs
     5029        if (num_eas != 27) {
     5030#else
    50285031        if (num_eas != 20) {
     5032#endif
    50295033                printf("Should be 20 EA's stored... failing.\n");
    50305034                correct = False;
     
    50405044        printf("Now deleting all EA's - case indepenent....\n");
    50415045
    5042 #if 1
     5046#if 0 // YD see bug#3212, smb_info_set_ea(), this is a NOP now!
    50435047        cli_set_ea_path(cli, fname, "", "", 0);
    50445048#else
  • trunk/server/source3/utils/net_usershare.c

    r414 r454  
    946946
    947947        /* Attempt to replace any existing share by this name. */
     948#ifdef __OS2__
     949        close(tmpfd);
     950#endif
    948951        if (rename(full_path_tmp, full_path) != 0) {
    949952                unlink(full_path_tmp);
     
    957960        }
    958961
     962#ifndef __OS2__
    959963        close(tmpfd);
     964#endif
    960965
    961966        if (c->opt_long_list_entries) {
  • trunk/server/source3/utils/net_util.c

    r414 r454  
    100100        int flags = 0;
    101101
     102#ifdef __OS2__
     103        if (!c->opt_user_name || c->opt_user_name == NULL) {
     104                d_printf("The username was not set.\n");
     105                return NT_STATUS_LOGON_FAILURE;
     106        }
     107#endif
     108
    102109        c->opt_password = net_prompt_pass(c, c->opt_user_name);
    103110
  • trunk/server/source3/web/cgi.c

    r414 r454  
    315315        }
    316316
     317#ifndef __OS2__
    317318        pwd = getpwnam_alloc(talloc_autofree_context(), user);
    318319        if (!pwd) {
     
    329330        }
    330331        TALLOC_FREE(pwd);
     332#endif
    331333}
    332334
  • trunk/server/source3/web/startstop.c

    r414 r454  
    1919
    2020#include "includes.h"
     21
     22#ifdef __OS2__
     23        /* fork() in klibc on OS/2 ends all children when parent
     24           is closed, therefore we use spawn() */
     25#include "process.h"
     26#define SWAT_HELPER(WHAT, WHO) \
     27        asprintf(&binfile, "%s/swathelp.cmd", getcwd(NULL, _MAX_PATH)); \
     28        int rc; \
     29        rc=spawnl(P_NOWAIT, binfile, binfile, #WHAT, #WHO, NULL);
     30#endif
     31
    2132#include "web/swat_proto.h"
    2233#include "dynconfig.h"
     
    3243        }
    3344
     45#ifdef __OS2__
     46        /* fork() in klibc on OS/2 ends all children when parent
     47           is closed, therefore we use spawn() */
     48        SWAT_HELPER(start, smbd)       
     49#else   
    3450        if (fork()) {
    3551                return;
     
    4157        }
    4258        exit(0);
     59#endif
    4360}
    4461
     
    5269        }
    5370
     71#ifdef __OS2__
     72        /* fork() in klibc on OS/2 ends all children when parent
     73           is closed, therefore we use spawn() */
     74        SWAT_HELPER(start, nmbd)
     75#else   
    5476        if (fork()) {
    5577                return;
     
    6183        }
    6284        exit(0);
     85#endif
    6386}
    6487
     
    7295        }
    7396
     97#ifdef __OS2__
     98        /* fork() in klibc on OS/2 ends all children when parent
     99           is closed, therefore we use spawn() */
     100        SWAT_HELPER(start, winbindd)
     101#else   
    74102        if (fork()) {
    75103                return;
     
    81109        }
    82110        exit(0);
     111#endif
    83112}
    84113
     
    91120        if (geteuid() != 0) return;
    92121
     122#ifdef __OS2__  /* we do it a bit nicer */
     123        if (smbd_running()) {
     124                char *binfile = NULL;
     125                SWAT_HELPER(stop, smbd)
     126        }
     127#else
    93128        if (pid <= 0) return;
    94129
    95130        kill(pid, SIGTERM);
     131#endif
    96132}
    97133
     
    103139        if (geteuid() != 0) return;
    104140
     141#ifdef __OS2__  /* we do it a bit nicer */
     142        if (nmbd_running()) {
     143                char *binfile = NULL;
     144                SWAT_HELPER(stop, nmbd)
     145        }
     146#else
    105147        if (pid <= 0) return;
    106148
    107149        kill(pid, SIGTERM);
     150#endif
    108151}
    109152#ifdef WITH_WINBIND
     
    115158        if (geteuid() != 0) return;
    116159
     160#ifdef __OS2__  /* we do it a bit nicer */
     161        if (winbindd_running()) {
     162                char *binfile = NULL;
     163                SWAT_HELPER(stop, winbindd)
     164        }
     165#else
    117166        if (pid <= 0) return;
    118167
    119168        kill(pid, SIGTERM);
     169#endif
    120170}
    121171#endif
  • trunk/server/source3/web/swat.c

    r414 r454  
    14371437        load_printers();
    14381438
     1439#ifndef __OS2__
    14391440        cgi_setup(get_dyn_SWATDIR(), !demo_mode);
     1441#else
     1442
     1443#if 0
     1444        debug_set_logfile("swat.log"); // this produces a logfile in the dir where swat.exe is located.
     1445#endif
     1446
     1447        fstring path;
     1448        fstrcpy(path, getcwd(NULL, _MAX_PATH));
     1449        fstrcat(path, "/swat");
     1450        cgi_setup(path, !demo_mode);
     1451#endif
    14401452
    14411453        print_header();
Note: See TracChangeset for help on using the changeset viewer.