~ubuntu-branches/ubuntu/utopic/xdm/utopic

« back to all changes in this revision

Viewing changes to session.c

  • Committer: Bazaar Package Importer
  • Author(s): David Nusinow, Eugene Konev
  • Date: 2006-06-30 00:42:11 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060630004211-m2ntbay7eepml8pb
Tags: 1:1.0.5-1
[ Eugene Konev ]
* New upstream release. Fixes security bug on linux-2.6 kernels.
* Don't build-depend on libselinux1-dev on non-linux arches, thanks
  Michael Banck and Christian Perrier (closes: #369519)
* Fix init script reload target, thanks Alexandr Kazda (closes: #365548)
* Fix authDir reference in xdm(1), thanks Kevin Ryde (closes: #373138)
* Update README.Debian, thanks Kevin Ryde (closes: #373870)
* Pass APP_MAN_SUFFIX=1 to configure explicitely.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XdotOrg: xc/programs/xdm/session.c,v 1.1.4.4 2003/12/06 13:24:29 kaleb Exp $ */
 
1
/* $XdotOrg: app/xdm/session.c,v 1.6.2.1 2006/06/22 18:55:23 alanc Exp $ */
2
2
/* $Xorg: session.c,v 1.8 2001/02/09 02:05:40 xorgcvs Exp $ */
3
3
/*
4
4
 
55
55
#ifdef SECURE_RPC
56
56
# include <rpc/rpc.h>
57
57
# include <rpc/key_prot.h>
 
58
# if !HAVE_DECL_KEY_SETNET
58
59
extern int key_setnet(struct key_netstarg *arg);
 
60
# endif
59
61
#endif
60
62
#ifdef K5AUTH
61
63
# include <krb5/krb5.h>
74
76
 
75
77
static  int     runAndWait (char **args, char **environ);
76
78
 
77
 
#if defined(CSRG_BASED) || defined(__osf__) || defined(__DARWIN__) || defined(__QNXNTO__) || defined(sun) || defined(__GLIBC__) || defined(__SCO__)
 
79
#ifdef HAVE_GRP_H
78
80
# include <sys/types.h>
79
81
# include <grp.h>
80
82
#else
488
490
    else
489
491
        ResetServer (d);
490
492
    if (removeAuth) {
491
 
        setgid (verify.gid);
492
 
        setuid (verify.uid);
 
493
        if (setgid (verify.gid) == -1) {
 
494
            LogError( "SessionExit: setgid: %s\n", strerror(errno));
 
495
            exit(status);
 
496
        }
 
497
        if (setuid (verify.uid) == -1) {
 
498
            LogError( "SessionExit: setuid: %s\n", strerror(errno));
 
499
            exit(status);
 
500
        }
493
501
        RemoveUserAuthorization (d, &verify);
494
502
#ifdef K5AUTH
495
503
        /* do like "kdestroy" program */
568
576
 
569
577
        /* Do system-dependent login setup here */
570
578
 
571
 
#ifdef USE_PAM
572
 
        /* pass in environment variables set by libpam and modules it called */
573
 
        if (pamh) {
574
 
            long i;
575
 
            char **pam_env = pam_getenvlist(pamh);
576
 
            for(i = 0; pam_env && pam_env[i]; i++) {
577
 
                verify->userEnviron = putEnv(pam_env[i], verify->userEnviron);
578
 
            }
579
 
        }
580
 
#endif
581
 
 
582
579
#ifdef USESECUREWARE
583
580
        Debug ("set_identity: uid=%d\n", userp->pw.pw_uid);
584
581
        ret = smp_set_identity (userp, &reason, &smpenv, &smpshell);
630
627
#endif   /* QNX4 doesn't support multi-groups, no initgroups() */
631
628
#ifdef USE_PAM
632
629
        if (pamh) {
 
630
            long i;
 
631
            char **pam_env;
 
632
 
633
633
            pam_error = pam_setcred (pamh, PAM_ESTABLISH_CRED);
634
634
            if (pam_error != PAM_SUCCESS) {
635
635
                LogError ("pam_setcred for \"%s\" failed: %s\n",
636
636
                         name, pam_strerror(pamh, pam_error));
637
637
                return(0);
638
638
            }
 
639
 
 
640
            /* pass in environment variables set by libpam and modules it called */
 
641
            pam_env = pam_getenvlist(pamh);
 
642
            for(i = 0; pam_env && pam_env[i]; i++) {
 
643
                verify->userEnviron = putEnv(pam_env[i], verify->userEnviron);
 
644
            }
 
645
 
639
646
        }
640
647
#endif
641
648
        if (setuid(verify->uid) < 0) {