Deleted Added
full compact
bsd-cray.c (124208) bsd-cray.c (126274)
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 *
4 * bsd-cray.c
5 *
6 * Copyright (c) 2002, Cray Inc. (Wendy Palm <wendyp@cray.com>)
7 * Significant portions provided by
8 * Wayne Schroeder, SDSC <schroeder@sdsc.edu>
9 * William Jones, UTexas <jones@tacc.utexas.edu>
10 *

--- 43 unchanged lines hidden (view full) ---

54#include <sys/session.h>
55#include <stdlib.h>
56#include <pwd.h>
57#include <fcntl.h>
58#include <errno.h>
59#include <ia.h>
60#include <urm.h>
61#include "ssh.h"
3 *
4 * bsd-cray.c
5 *
6 * Copyright (c) 2002, Cray Inc. (Wendy Palm <wendyp@cray.com>)
7 * Significant portions provided by
8 * Wayne Schroeder, SDSC <schroeder@sdsc.edu>
9 * William Jones, UTexas <jones@tacc.utexas.edu>
10 *

--- 43 unchanged lines hidden (view full) ---

54#include <sys/session.h>
55#include <stdlib.h>
56#include <pwd.h>
57#include <fcntl.h>
58#include <errno.h>
59#include <ia.h>
60#include <urm.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"
63#include "servconf.h"
64#include "bsd-cray.h"
65
66#define MAXACID 80
67
68extern ServerOptions options;
69

--- 107 unchanged lines hidden (view full) ---

177 int jid; /* job ID */
178 int pid; /* process ID */
179 char *sr; /* status return from setlimits() */
180 char *ttyn = NULL; /* ttyname or command name*/
181 char hostname[MAXHOSTNAMELEN];
182 /* passwd stuff for ia_user */
183 passwd_t pwdacm, pwddialup, pwdudb, pwdwal, pwddce;
184 ia_user_ret_t uret; /* stuff returned from ia_user */
84#include "log.h"
85#include "servconf.h"
86#include "bsd-cray.h"
87
88#define MAXACID 80
89
90extern ServerOptions options;
91

--- 107 unchanged lines hidden (view full) ---

199 int jid; /* job ID */
200 int pid; /* process ID */
201 char *sr; /* status return from setlimits() */
202 char *ttyn = NULL; /* ttyname or command name*/
203 char hostname[MAXHOSTNAMELEN];
204 /* passwd stuff for ia_user */
205 passwd_t pwdacm, pwddialup, pwdudb, pwdwal, pwddce;
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 */
187 ia_failure_t fsent; /* ia_failure structure */
188 ia_failure_ret_t fret; /* ia_failure return stuff */
189 ia_success_t ssent; /* ia_success structure */
190 ia_success_ret_t sret; /* ia_success return stuff */
191 int ia_mlsrcode; /* ia_mlsuser return code */
192 int secstatrc; /* [f]secstat return code */
193

--- 302 unchanged lines hidden (view full) ---

496 printf("\"acctid\" permbit also allows"
497 " you to select any valid "
498 "account name.\n");
499 }
500 printf("\n");
501 break;
502 default:
503 valid_acct = nam2acid(acct_name);
208 int ia_rcode; /* ia_user return code */
209 ia_failure_t fsent; /* ia_failure structure */
210 ia_failure_ret_t fret; /* ia_failure return stuff */
211 ia_success_t ssent; /* ia_success structure */
212 ia_success_ret_t sret; /* ia_success return stuff */
213 int ia_mlsrcode; /* ia_mlsuser return code */
214 int secstatrc; /* [f]secstat return code */
215

--- 302 unchanged lines hidden (view full) ---

518 printf("\"acctid\" permbit also allows"
519 " you to select any valid "
520 "account name.\n");
521 }
522 printf("\n");
523 break;
524 default:
525 valid_acct = nam2acid(acct_name);
504 if (valid_acct == -1) {
526 if (valid_acct == -1)
505 printf(
506 "Account id not found for"
507 " account name \"%s\"\n\n",
508 acct_name);
509 break;
527 printf(
528 "Account id not found for"
529 " account name \"%s\"\n\n",
530 acct_name);
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
536 * respond to an acid prompt. Use default acid.
534 * If an account was given, search the user's
535 * acids array to verify they can use this account.
537 */
536 */
538 debug("cray_setup: ttyname false case, %.100s",
539 ttyname);
540 valid_acct = ue.ue_acids[0];
537 if ((valid_acct != -1) &&
538 !(ue.ue_permbits & PERMBITS_ACCTID)) {
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 }
542 } else {
543 /*
554 }
555 } else {
556 /*
544 * The user doesn't have the askacid permbit set or
545 * only has one valid account to use.
557 * The client isn't connected to a terminal and can't
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];
548 }
562 valid_acct = ue.ue_acids[0];
563 }
549 if (acctid(0, valid_acct) < 0) {
550 printf ("Bad account id: %d\n", valid_acct);
551 exit(1);
564 } else {
565 /*
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];
552 }
570 }
571 if (acctid(0, valid_acct) < 0) {
572 printf ("Bad account id: %d\n", valid_acct);
573 exit(1);
574 }
553
554 /*
555 * Now set shares, quotas, limits, including CPU time for the
556 * (interactive) job and process, and set up permissions
557 * (for chown etc), etc.
558 */
559 if (setshares(ue.ue_uid, valid_acct, printf, 0, 0)) {
560 printf("Unable to give %d shares to <%s>(%d/%d)\n",

--- 212 unchanged lines hidden (view full) ---

773 return;
774
775 /*
776 * Set jid and tmpdir in utmp record.
777 */
778 ut->ut_jid = jid;
779 strncpy(ut->ut_tpath, cray_tmpdir, TPATHSIZ);
780}
575
576 /*
577 * Now set shares, quotas, limits, including CPU time for the
578 * (interactive) job and process, and set up permissions
579 * (for chown etc), etc.
580 */
581 if (setshares(ue.ue_uid, valid_acct, printf, 0, 0)) {
582 printf("Unable to give %d shares to <%s>(%d/%d)\n",

--- 212 unchanged lines hidden (view full) ---

795 return;
796
797 /*
798 * Set jid and tmpdir in utmp record.
799 */
800 ut->ut_jid = jid;
801 strncpy(ut->ut_tpath, cray_tmpdir, TPATHSIZ);
802}
781#endif
803#endif /* UNICOS */
804
805#ifdef _UNICOSMP
806#include <pwd.h>
807/*
808 * Set job id and create tmpdir directory.
809 */
810void
811cray_init_job(struct passwd *pw)
812{
813 initrm_silent(pw->pw_uid);
814 return;
815}
816#endif /* _UNICOSMP */