diff options
Diffstat (limited to 'openbsd-compat/bsd-cray.c')
-rw-r--r-- | openbsd-compat/bsd-cray.c | 109 |
1 files changed, 72 insertions, 37 deletions
diff --git a/openbsd-compat/bsd-cray.c b/openbsd-compat/bsd-cray.c index f2ac428cc..f630366be 100644 --- a/openbsd-compat/bsd-cray.c +++ b/openbsd-compat/bsd-cray.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: bsd-cray.c,v 1.12 2003/06/03 02:45:27 dtucker Exp $ | 2 | * $Id: bsd-cray.c,v 1.13 2004/01/30 03:34:22 dtucker Exp $ |
3 | * | 3 | * |
4 | * bsd-cray.c | 4 | * bsd-cray.c |
5 | * | 5 | * |
@@ -59,6 +59,28 @@ | |||
59 | #include <ia.h> | 59 | #include <ia.h> |
60 | #include <urm.h> | 60 | #include <urm.h> |
61 | #include "ssh.h" | 61 | #include "ssh.h" |
62 | |||
63 | #include "includes.h" | ||
64 | #include "sys/types.h" | ||
65 | |||
66 | #ifndef HAVE_STRUCT_SOCKADDR_STORAGE | ||
67 | # define _SS_MAXSIZE 128 /* Implementation specific max size */ | ||
68 | # define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) | ||
69 | |||
70 | # define ss_family ss_sa.sa_family | ||
71 | #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ | ||
72 | |||
73 | #ifndef IN6_IS_ADDR_LOOPBACK | ||
74 | # define IN6_IS_ADDR_LOOPBACK(a) \ | ||
75 | (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ | ||
76 | ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) | ||
77 | #endif /* !IN6_IS_ADDR_LOOPBACK */ | ||
78 | |||
79 | #ifndef AF_INET6 | ||
80 | /* Define it to something that should never appear */ | ||
81 | #define AF_INET6 AF_MAX | ||
82 | #endif | ||
83 | |||
62 | #include "log.h" | 84 | #include "log.h" |
63 | #include "servconf.h" | 85 | #include "servconf.h" |
64 | #include "bsd-cray.h" | 86 | #include "bsd-cray.h" |
@@ -182,7 +204,7 @@ cray_setup (uid_t uid, char *username, const char *command) | |||
182 | /* passwd stuff for ia_user */ | 204 | /* passwd stuff for ia_user */ |
183 | passwd_t pwdacm, pwddialup, pwdudb, pwdwal, pwddce; | 205 | passwd_t pwdacm, pwddialup, pwdudb, pwdwal, pwddce; |
184 | ia_user_ret_t uret; /* stuff returned from ia_user */ | 206 | ia_user_ret_t uret; /* stuff returned from ia_user */ |
185 | ia_user_t usent /* ia_user main structure */ | 207 | ia_user_t usent; /* ia_user main structure */ |
186 | int ia_rcode; /* ia_user return code */ | 208 | int ia_rcode; /* ia_user return code */ |
187 | ia_failure_t fsent; /* ia_failure structure */ | 209 | ia_failure_t fsent; /* ia_failure structure */ |
188 | ia_failure_ret_t fret; /* ia_failure return stuff */ | 210 | ia_failure_ret_t fret; /* ia_failure return stuff */ |
@@ -501,54 +523,54 @@ cray_setup (uid_t uid, char *username, const char *command) | |||
501 | break; | 523 | break; |
502 | default: | 524 | default: |
503 | valid_acct = nam2acid(acct_name); | 525 | valid_acct = nam2acid(acct_name); |
504 | if (valid_acct == -1) { | 526 | if (valid_acct == -1) |
505 | printf( | 527 | printf( |
506 | "Account id not found for" | 528 | "Account id not found for" |
507 | " account name \"%s\"\n\n", | 529 | " account name \"%s\"\n\n", |
508 | acct_name); | 530 | acct_name); |
509 | break; | 531 | break; |
510 | } | ||
511 | /* | ||
512 | * If an account was given, search the user's | ||
513 | * acids array to verify they can use this account. | ||
514 | */ | ||
515 | if ((valid_acct != -1) && | ||
516 | !(ue.ue_permbits & PERMBITS_ACCTID)) { | ||
517 | for (i = 0; i < MAXVIDS; i++) { | ||
518 | if (ue.ue_acids[i] == -1) | ||
519 | break; | ||
520 | if (valid_acct == ue.ue_acids[i]) | ||
521 | break; | ||
522 | } | ||
523 | if (i == MAXVIDS || | ||
524 | ue.ue_acids[i] == -1) { | ||
525 | fprintf(stderr, "Cannot set" | ||
526 | " account name to " | ||
527 | "\"%s\", permission " | ||
528 | "denied\n\n", acct_name); | ||
529 | valid_acct = -1; | ||
530 | } | ||
531 | } | ||
532 | } | 532 | } |
533 | } else { | ||
534 | /* | 533 | /* |
535 | * The client isn't connected to a terminal and can't | 534 | * If an account was given, search the user's |
536 | * respond to an acid prompt. Use default acid. | 535 | * acids array to verify they can use this account. |
537 | */ | 536 | */ |
538 | debug("cray_setup: ttyname false case, %.100s", | 537 | if ((valid_acct != -1) && |
539 | ttyname); | 538 | !(ue.ue_permbits & PERMBITS_ACCTID)) { |
540 | valid_acct = ue.ue_acids[0]; | 539 | for (i = 0; i < MAXVIDS; i++) { |
540 | if (ue.ue_acids[i] == -1) | ||
541 | break; | ||
542 | if (valid_acct == ue.ue_acids[i]) | ||
543 | break; | ||
544 | } | ||
545 | if (i == MAXVIDS || | ||
546 | ue.ue_acids[i] == -1) { | ||
547 | fprintf(stderr, "Cannot set" | ||
548 | " account name to " | ||
549 | "\"%s\", permission " | ||
550 | "denied\n\n", acct_name); | ||
551 | valid_acct = -1; | ||
552 | } | ||
553 | } | ||
541 | } | 554 | } |
542 | } else { | 555 | } else { |
543 | /* | 556 | /* |
544 | * The user doesn't have the askacid permbit set or | 557 | * The client isn't connected to a terminal and can't |
545 | * only has one valid account to use. | 558 | * respond to an acid prompt. Use default acid. |
546 | */ | 559 | */ |
560 | debug("cray_setup: ttyname false case, %.100s", | ||
561 | ttyname); | ||
547 | valid_acct = ue.ue_acids[0]; | 562 | valid_acct = ue.ue_acids[0]; |
548 | } | 563 | } |
549 | if (acctid(0, valid_acct) < 0) { | 564 | } else { |
550 | printf ("Bad account id: %d\n", valid_acct); | 565 | /* |
551 | exit(1); | 566 | * The user doesn't have the askacid permbit set or |
567 | * only has one valid account to use. | ||
568 | */ | ||
569 | valid_acct = ue.ue_acids[0]; | ||
570 | } | ||
571 | if (acctid(0, valid_acct) < 0) { | ||
572 | printf ("Bad account id: %d\n", valid_acct); | ||
573 | exit(1); | ||
552 | } | 574 | } |
553 | 575 | ||
554 | /* | 576 | /* |
@@ -778,4 +800,17 @@ cray_set_tmpdir(struct utmp *ut) | |||
778 | ut->ut_jid = jid; | 800 | ut->ut_jid = jid; |
779 | strncpy(ut->ut_tpath, cray_tmpdir, TPATHSIZ); | 801 | strncpy(ut->ut_tpath, cray_tmpdir, TPATHSIZ); |
780 | } | 802 | } |
781 | #endif | 803 | #endif /* UNICOS */ |
804 | |||
805 | #ifdef _UNICOSMP | ||
806 | #include <pwd.h> | ||
807 | /* | ||
808 | * Set job id and create tmpdir directory. | ||
809 | */ | ||
810 | void | ||
811 | cray_init_job(struct passwd *pw) | ||
812 | { | ||
813 | initrm_silent(pw->pw_uid); | ||
814 | return; | ||
815 | } | ||
816 | #endif /* _UNICOSMP */ | ||