15 #include <sys/resource.h>
19 extern ServerOptions options;
20 extern int saved_argc;
21 extern char **saved_argv;
26 auth_sia_password(char *user, char *pass)
29 SIAENTITY *ent = NULL;
32 host = get_canonical_hostname(options.reverse_mapping_check);
37 if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, NULL, 0,
41 if ((ret = sia_ses_authent(NULL, pass, ent)) != SIASUCCESS) {
42 error("couldn't authenticate %s from %s", user, host);
44 sia_ses_release(&ent);
48 sia_ses_release(&ent);
54 session_setup_sia(char *user, char *tty)
58 SIAENTITY *ent = NULL;
61 host = get_canonical_hostname (options.reverse_mapping_check);
63 if (sia_ses_init(&ent, saved_argc, saved_argv, host, user, tty, 0,
65 fatal("sia_ses_init failed");
67 if ((pw = getpwnam(user)) == NULL) {
68 sia_ses_release(&ent);
69 fatal("getpwnam(%s) failed: %s", user, strerror(errno));
71 if (sia_make_entity_pwd(pw, ent) != SIASUCCESS) {
72 sia_ses_release(&ent);
73 fatal("sia_make_entity_pwd failed");
76 ent->authtype = SIA_A_NONE;
77 if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS)
78 fatal("couldn't establish session for %s from %s", user,
81 if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
82 sia_ses_release(&ent);
83 fatal("setpriority failed: %s", strerror (errno));
86 if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS)
87 fatal("couldn't launch session for %s from %s", user, host);
89 sia_ses_release(&ent);
91 if (setreuid(geteuid(), geteuid()) < 0)
92 fatal("setreuid failed: %s", strerror (errno));
95 #endif /* HAVE_OSF_SIA */