]> andersk Git - gssapi-openssh.git/blobdiff - openssh/openbsd-compat/bsd-cray.c
Import of OpenSSH 3.8p1
[gssapi-openssh.git] / openssh / openbsd-compat / bsd-cray.c
index 7b8cfb142eacb257aec439132fffa1ea20e3ff9e..9761a8b94dca00b2389e420200130fec31a1c669 100644 (file)
 #include <ia.h>
 #include <urm.h>
 #include "ssh.h"
+
+#include "includes.h"
+#include "sys/types.h"
+
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
+# define      _SS_MAXSIZE     128     /* Implementation specific max size */
+# define       _SS_PADSIZE     (_SS_MAXSIZE - sizeof (struct sockaddr))
+
+# define ss_family ss_sa.sa_family
+#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
+
+#ifndef IN6_IS_ADDR_LOOPBACK
+# define IN6_IS_ADDR_LOOPBACK(a) \
+       (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
+        ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
+#endif /* !IN6_IS_ADDR_LOOPBACK */
+
+#ifndef AF_INET6
+/* Define it to something that should never appear */
+#define AF_INET6 AF_MAX
+#endif
+
 #include "log.h"
 #include "servconf.h"
 #include "bsd-cray.h"
@@ -182,7 +204,7 @@ cray_setup (uid_t uid, char *username, const char *command)
        /* passwd stuff for ia_user */
        passwd_t pwdacm, pwddialup, pwdudb, pwdwal, pwddce;
        ia_user_ret_t uret;             /* stuff returned from ia_user */
-       ia_user_t usent                 /* ia_user main structure */
+       ia_user_t usent;                /* ia_user main structure */
        int ia_rcode;                   /* ia_user return code */
        ia_failure_t fsent;             /* ia_failure structure */
        ia_failure_ret_t fret;          /* ia_failure return stuff */
@@ -501,54 +523,54 @@ cray_setup (uid_t uid, char *username, const char *command)
                                        break;
                                default:
                                        valid_acct = nam2acid(acct_name);
-                                       if (valid_acct == -1) {
+                                       if (valid_acct == -1) 
                                                printf(
                                                    "Account id not found for"
                                                    " account name \"%s\"\n\n",
                                                    acct_name);
                                        break;
-                                       }
-                                       /*
-                                        * If an account was given, search the user's
-                                        * acids array to verify they can use this account.
-                                        */
-                                       if ((valid_acct != -1) &&
-                                           !(ue.ue_permbits & PERMBITS_ACCTID)) {
-                                               for (i = 0; i < MAXVIDS; i++) {
-                                                       if (ue.ue_acids[i] == -1)
-                                                               break;
-                                                       if (valid_acct == ue.ue_acids[i])
-                                                               break;
-                                               }
-                                               if (i == MAXVIDS ||
-                                                   ue.ue_acids[i] == -1) {
-                                                       fprintf(stderr, "Cannot set"
-                                                           " account name to "
-                                                           "\"%s\", permission "
-                                                           "denied\n\n", acct_name);
-                                                       valid_acct = -1;
-                                               }
-                                       }
                                }
-                       } else {
                                /*
-                                * The client isn't connected to a terminal and can't
-                                * respond to an acid prompt.  Use default acid.
+                                * If an account was given, search the user's
+                                * acids array to verify they can use this account.
                                 */
-                               debug("cray_setup: ttyname false case, %.100s",
-                                   ttyname);
-                               valid_acct = ue.ue_acids[0];
+                               if ((valid_acct != -1) &&
+                                   !(ue.ue_permbits & PERMBITS_ACCTID)) {
+                                       for (i = 0; i < MAXVIDS; i++) {
+                                               if (ue.ue_acids[i] == -1)
+                                                       break;
+                                               if (valid_acct == ue.ue_acids[i])
+                                                       break;
+                                       }
+                                       if (i == MAXVIDS ||
+                                           ue.ue_acids[i] == -1) {
+                                               fprintf(stderr, "Cannot set"
+                                                   " account name to "
+                                                   "\"%s\", permission "
+                                                   "denied\n\n", acct_name);
+                                               valid_acct = -1;
+                                       }
+                               }
                        }
                } else {
                        /*
-                        * The user doesn't have the askacid permbit set or
-                        * only has one valid account to use.
+                        * The client isn't connected to a terminal and can't
+                        * respond to an acid prompt.  Use default acid.
                         */
+                       debug("cray_setup: ttyname false case, %.100s",
+                           ttyname);
                        valid_acct = ue.ue_acids[0];
                }
-               if (acctid(0, valid_acct) < 0) {
-                       printf ("Bad account id: %d\n", valid_acct);
-                       exit(1);
+       } else {
+               /*
+                * The user doesn't have the askacid permbit set or
+                * only has one valid account to use.
+                */
+               valid_acct = ue.ue_acids[0];
+       }
+       if (acctid(0, valid_acct) < 0) {
+               printf ("Bad account id: %d\n", valid_acct);
+               exit(1);
        }
 
        /* 
@@ -778,4 +800,17 @@ cray_set_tmpdir(struct utmp *ut)
        ut->ut_jid = jid;
        strncpy(ut->ut_tpath, cray_tmpdir, TPATHSIZ);
 }
-#endif
+#endif /* UNICOS */
+
+#ifdef _UNICOSMP
+#include <pwd.h>
+/*
+ * Set job id and create tmpdir directory.
+ */
+void
+cray_init_job(struct passwd *pw)
+{
+       initrm_silent(pw->pw_uid);
+       return;
+}
+#endif /* _UNICOSMP */
This page took 0.040917 seconds and 4 git commands to generate.