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,
64 NULL) != SIASUCCESS) {
65 error("sia_ses_init failed");
69 if ((pw = getpwnam(user)) == NULL) {
70 sia_ses_release(&ent);
71 error("getpwnam(%s) failed: %s", user, strerror(errno));
74 if (sia_make_entity_pwd(pw, ent) != SIASUCCESS) {
75 sia_ses_release(&ent);
76 error("sia_make_entity_pwd failed");
80 ent->authtype = SIA_A_NONE;
81 if (sia_ses_estab(sia_collect_trm, ent) != SIASUCCESS) {
82 error("couldn't establish session for %s from %s", user,
87 if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
88 sia_ses_release(&ent);
89 error("setpriority failed: %s", strerror (errno));
93 if (sia_ses_launch(sia_collect_trm, ent) != SIASUCCESS) {
94 error("couldn't launch session for %s from %s", user, host);
98 sia_ses_release(&ent);
100 if (setreuid(geteuid(), geteuid()) < 0) {
101 error("setreuid failed: %s", strerror (errno));
106 #endif /* HAVE_OSF_SIA */