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/lib
Files:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.