~ubuntu-branches/ubuntu/dapper/splitvt/dapper-security

« back to all changes in this revision

Viewing changes to misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2009-10-07 07:42:51 UTC
  • Revision ID: james.westby@ubuntu.com-20091007074251-2etk694a1trcj0cu
Tags: 1.6.5-9etch1build0.6.06.1
fake sync from Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include        <sys/stat.h>
10
10
#include        <fcntl.h>
11
11
#include        <stdio.h>
 
12
#include        <stdlib.h>
 
13
#include        <string.h>
12
14
#include        <signal.h>
13
15
#include        <utime.h>
14
16
#include        <string.h>
119
121
                (void) utime(get_ttyname(), NULL);
120
122
 
121
123
                /* Set our gid to our real gid if necessary */
122
 
                (void) setgid(getgid());
 
124
                if (setgid(getgid()) != 0) {
 
125
                        perror("setgid");
 
126
                        exit(1);
 
127
                }
123
128
                /* Set our uid to our real uid if necessary */
124
 
                (void) setuid(getuid());
 
129
                if (setuid(getuid()) != 0) {
 
130
                        perror("setuid");
 
131
                        exit(1);
 
132
                }
125
133
                        
126
134
                /* Run the requested program, with possible leading dash. */
127
135
                execvp(((*argv[0] == '-') ? argv[0]+1 : argv[0]), argv);
196
204
#else /* ! IRIX */
197
205
 
198
206
 
199
 
#if defined(SOLARIS) || defined(__GLIBC__)
200
 
/* System V.4 pty routines from W. Richard Stevens */
201
 
/* GLIBC is very similar, so this will handle it too. */
 
207
#if defined(SOLARIS) || defined(__GLIBC__)      /* System V.4 pty routines from W. Richard Stevens */
202
208
 
203
209
#ifdef SOLARIS
204
 
 
205
210
#include <stropts.h>
206
211
 
207
212
#define DEV_CLONE       "/dev/ptmx"
289
294
                return(-1);
290
295
        }
291
296
#endif
292
 
        
 
297
 
293
298
        return(slave_fd);
294
299
}
295
300
 
388
393
        return(slave_fd);
389
394
}
390
395
 
391
 
#endif  /* if SOLARIS */
 
396
#endif  /* if linux or SOLARIS */
392
397
#endif  /* if IRIX */
393
398
 
394
399
 
899
904
                        close(pipe_fds[0]); close(pipe_fds[1]); 
900
905
 
901
906
                        /* Set our uid to our real uid if necessary */
902
 
                        (void) setuid(getuid());
 
907
                        if (setgid(getgid()) != 0) {
 
908
                                perror("setgid");
 
909
                                exit(1);
 
910
                        }
 
911
                        if (setuid(getuid()) != 0) {
 
912
                                perror("setuid");
 
913
                                exit(1);
 
914
                        }
903
915
                        
904
916
                        /* Run the requested program */
905
917
                        argv[0]="/bin/sh";