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

File:
1 edited

Legend:

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