Bug 101 - session.c modifications for correct UNICOS behavior
Summary: session.c modifications for correct UNICOS behavior
Status: CLOSED INVALID
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: -current
Hardware: Other Other
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-05 06:22 AEDT by wendy palm
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wendy palm 2002-02-05 06:22:39 AEDT
--- session.c.orig      Mon Feb  4 12:32:52 2002
+++ session.c   Mon Feb  4 13:03:18 2002
@@ -67,6 +67,10 @@
 #include <sat.h>
 #endif /* WITH_IRIX_AUDIT */

+#ifdef _CRAY
+#include <tmpdir.h>
+#endif
+
 #if defined(HAVE_USERSEC_H)
 #include <usersec.h>
 #endif
@@ -494,11 +498,16 @@
                if (dup2(err[0], 2) < 0)        /* stderr */
                        perror("dup2 stderr");
 #endif /* USE_PIPES */
-
+#ifdef _CRAY
+               cray_init_job(s->pw); /* set up cray jid and tmpdir */
+#endif
                /* Do processing for the child (exec command etc). */
                do_child(s, command);
                /* NOTREACHED */
        }
+#ifdef _CRAY
+       signal(WJSIGNAL, cray_job_termination_handler);
+#endif /* _CRAY */
 #ifdef HAVE_CYGWIN
        if (is_winnt)
                cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
@@ -586,7 +595,12 @@
                /* record login, etc. similar to login(1) */
 #ifndef HAVE_OSF_SIA
                if (!(options.use_login && command == NULL))
+               {
+# ifdef _CRAY
+                       cray_init_job(s->pw); /* set up cray jid and tmpdir */
+# endif        /* _CRAY */
                        do_login(s, command);
+               }
 # ifdef LOGIN_NEEDS_UTMPX
                else
                        do_pre_login(s);
@@ -597,6 +611,9 @@
                do_child(s, command);
                /* NOTREACHED */
        }
+#ifdef _CRAY
+       signal(WJSIGNAL, cray_job_termination_handler);
+#endif /* _CRAY */
 #ifdef HAVE_CYGWIN
        if (is_winnt)
                cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
@@ -743,6 +760,7 @@
                printf("%s\n", aixloginmsg);
 #endif /* WITH_AIXAUTHENTICATE */

+#ifndef _CRAY
        if (options.print_lastlog && last_login_time != 0) {
                time_string = ctime(&last_login_time);
                if (strchr(time_string, '\n'))
@@ -752,6 +770,7 @@
                else
                        printf("Last login: %s from %s\r\n", time_string, hostna
me);
        }
+#endif /* ! _CRAY */

        do_motd();
 }
@@ -1027,16 +1046,17 @@
        if (options.use_login && command != NULL)
                options.use_login = 0;

-#if !defined(HAVE_OSF_SIA)
+#ifndef _CRAY
+# if !defined(HAVE_OSF_SIA)
        if (!options.use_login) {
-# ifdef HAVE_LOGIN_CAP
+#  ifdef HAVE_LOGIN_CAP
                if (!login_getcapbool(lc, "ignorenologin", 0) && pw->pw_uid)
                        f = fopen(login_getcapstr(lc, "nologin", _PATH_NOLOGIN,
                            _PATH_NOLOGIN), "r");
-# else /* HAVE_LOGIN_CAP */
+#  else /* HAVE_LOGIN_CAP */
                if (pw->pw_uid)
                        f = fopen(_PATH_NOLOGIN, "r");
-# endif /* HAVE_LOGIN_CAP */
+#  endif /* HAVE_LOGIN_CAP */
                if (f) {
                        /* /etc/nologin exists.  Print its contents and exit. */
                        while (fgets(buf, sizeof(buf), f))
@@ -1045,7 +1065,10 @@
                        exit(254);
                }
        }
-#endif /* HAVE_OSF_SIA */
+# endif /* HAVE_OSF_SIA */
+#else
+       cray_setup(pw->pw_uid, pw->pw_name, command);
+#endif /* _CRAY */

        /* Set login name, uid, gid, and groups. */
        /* Login(1) does this as well, and it needs uid 0 for the "-h"
@@ -1245,6 +1268,10 @@
        if (original_command)
                child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND",
                    original_command);
+#ifdef _CRAY
+       if (cray_tmpdir[0] != '\0')
+               child_set_env(&env, &envsize, "TMPDIR", cray_tmpdir);
+#endif /* _CRAY */

 #ifdef _AIX
        if ((cp = getenv("AUTHSTATE")) != NULL)
@@ -1392,11 +1419,13 @@
                                    "%.100s %.100s %.100s\n",
                                    options.xauth_location, s->auth_display[0],
                                    s->auth_proto, s->auth_data);
+#ifndef _CRAY
                                if (s->auth_display[1])
                                        fprintf(stderr,
                                            "add %.100s %.100s %.100s\n",
                                            s->auth_display[1],
                                            s->auth_proto, s->auth_data);
+#endif /* _CRAY */
                        }
                        snprintf(cmd, sizeof cmd, "%s -q -",
                            options.xauth_location);
@@ -1405,10 +1434,12 @@
                                fprintf(f, "add %s %s %s\n",
                                    s->auth_display[0], s->auth_proto,
                                    s->auth_data);
+#ifndef _CRAY
                                if (s->auth_display[1])
                                        fprintf(f, "add %s %s %s\n",
                                            s->auth_display[1], s->auth_proto,
                                            s->auth_data);
+#endif /* _CRAY */
                                pclose(f);
                        } else {
                                fprintf(stderr, "Could not run %s\n",
Comment 1 wendy palm 2002-04-23 08:43:00 AEST
updated patches for 22 april snapshot:

--- session.c.orig      Mon Apr 22 14:36:13 2002
+++ session.c   Mon Apr 22 16:31:15 2002
@@ -64,6 +64,10 @@
 #define is_winnt       (GetVersion() < 0x80000000)
 #endif
 
+#ifdef _CRAY
+#include <tmpdir.h>
+#endif /* _CRAY */
+
 /* func */
 
 Session *session_new(void);
@@ -425,11 +429,17 @@
                if (dup2(err[0], 2) < 0)        /* stderr */
                        perror("dup2 stderr");
 #endif /* USE_PIPES */
+#ifdef _CRAY
+               cray_init_job(s->pw); /* set up cray jid and tmpdir */
+#endif /* _CRAY */
 
                /* Do processing for the child (exec command etc). */
                do_child(s, command);
                /* NOTREACHED */
        }
+#ifdef _CRAY
+       signal(WJSIGNAL, cray_job_termination_handler);
+#endif /* _CRAY */
 #ifdef HAVE_CYGWIN
        if (is_winnt)
                cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
@@ -517,7 +527,12 @@
                /* record login, etc. similar to login(1) */
 #ifndef HAVE_OSF_SIA
                if (!(options.use_login && command == NULL))
+               {
+# ifdef _CRAY
+                       cray_init_job(s->pw); /* set up cray jid and tmpdir */
+# endif /* _CRAY */
                        do_login(s, command);
+               }
 # ifdef LOGIN_NEEDS_UTMPX
                else
                        do_pre_login(s);
@@ -528,6 +543,9 @@
                do_child(s, command);
                /* NOTREACHED */
        }
+#ifdef _CRAY
+       signal(WJSIGNAL, cray_job_termination_handler);
+#endif /* _CRAY */
 #ifdef HAVE_CYGWIN
        if (is_winnt)
                cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
@@ -668,6 +686,7 @@
                printf("%s\n", aixloginmsg);
 #endif /* WITH_AIXAUTHENTICATE */
 
+#ifndef _CRAY
        if (options.print_lastlog && s->last_login_time != 0) {
                time_string = ctime(&s->last_login_time);
                if (strchr(time_string, '\n'))
@@ -678,6 +697,7 @@
                        printf("Last login: %s from %s\r\n", time_string,
                            s->hostname);
        }
+#endif /* ! _CRAY */
 
        do_motd();
 }
@@ -916,7 +936,10 @@
        if (original_command)
                child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND",
                    original_command);
-
+#ifdef _CRAY
+       if (cray_tmpdir[0] != '\0')
+               child_set_env(&env, &envsize, "TMPDIR", cray_tmpdir);
+#endif /* _CRAY */
 #ifdef _AIX
        {
                char *cp;
@@ -1151,6 +1174,7 @@
         * Login(1) does this as well, and it needs uid 0 for the "-h"
         * switch, so we let login(1) to this for us.
         */
+#ifndef _CRAY
        if (!options.use_login) {
 #ifdef HAVE_OSF_SIA
                session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty);
@@ -1164,6 +1188,9 @@
                do_setusercontext(pw);
 #endif /* HAVE_OSF_SIA */
        }
+#else
+       cray_setup(pw->pw_uid, pw->pw_name, command);
+#endif /* _CRAY */
 
        /*
         * Get the shell from the password data.  An empty shell field is
Comment 2 wendy palm 2002-07-23 08:44:32 AEST
superceeded by bug 367
Comment 3 Damien Miller 2004-04-14 12:24:17 AEST
Mass change of RESOLVED bugs to CLOSED