]> arthur.barton.de Git - netatalk.git/commitdiff
Tru64 SIA fixes and Eddie and Burkhard.
authorsrittau <srittau>
Wed, 13 Feb 2002 16:44:59 +0000 (16:44 +0000)
committersrittau <srittau>
Wed, 13 Feb 2002 16:44:59 +0000 (16:44 +0000)
etc/afpd/uam.c
etc/uams/uams_dhx_passwd.c
etc/uams/uams_passwd.c
include/atalk/uam.h

index d96b2f5ea1f6ba818aa364426dfb2c150d576b84..76077fd403ab1f675cfbe402508ec247fa2d3e01 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uam.c,v 1.19 2002-01-19 21:29:55 jmarcus Exp $
+ * $Id: uam.c,v 1.20 2002-02-13 16:44:59 srittau Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
@@ -58,6 +58,9 @@ char *strchr (), *strrchr ();
 
 #ifdef TRU64
 #include <netdb.h>
+#include <sia.h>
+#include <siad.h>
+#include <signal.h>
 #endif /* TRU64 */
 
 /* --- server uam functions -- */
@@ -427,6 +430,50 @@ void uam_afp_getcmdline( int *ac, char ***av )
 {
     afp_get_cmdline( ac, av );
 }
+
+int uam_sia_validate_user(sia_collect_func_t * collect, int argc, char **argv,
+                         char *hostname, char *username, char *tty,
+                         int colinput, char *gssapi, char *passphrase)
+/* A clone of the Tru64 system function sia_validate_user() that calls
+ * sia_ses_authent() rather than sia_ses_reauthent()   
+ * Added extra code to take into account suspected SIA bug whereby it clobbers
+ * the signal handler on SIGALRM (tickle) installed by Netatalk/afpd
+ */
+{
+       SIAENTITY *entity = NULL;
+       struct sigaction act;
+       int rc;
+
+       if ((rc=sia_ses_init(&entity, argc, argv, hostname, username, tty,
+                            colinput, gssapi)) != SIASUCCESS) {
+               LOG(log_error, logtype_default, "cannot initialise SIA");
+               return SIAFAIL;
+       }
+
+       /* save old action for restoration later */
+       if (sigaction(SIGALRM, NULL, &act))
+               LOG(log_error, logtype_default, "cannot save SIGALRM handler");
+
+       if ((rc=sia_ses_authent(collect, passphrase, entity)) != SIASUCCESS) {
+               /* restore old action after clobbering by sia_ses_authent() */
+               if (sigaction(SIGALRM, &act, NULL))
+                       LOG(log_error, logtype_default, "cannot restore SIGALRM handler");
+
+               LOG(log_info, logtype_default, "unsuccessful login for %s",
+(hostname?hostname:"(null)"));
+               return SIAFAIL;
+       }
+       LOG(log_info, logtype_default, "successful login for %s",
+(hostname?hostname:"(null)"));
+
+       /* restore old action after clobbering by sia_ses_authent() */   
+       if (sigaction(SIGALRM, &act, NULL))
+               LOG(log_error, logtype_default, "cannot restore SIGALRM handler");
+
+       sia_ses_release(&entity);
+
+       return SIASUCCESS;
+}
 #endif /* TRU64 */
 
 /* --- papd-specific functions (just placeholders) --- */
index 0233bd6e6a0617d3104195b727c082b3fc707295..2a28f99f9c8b31fa0879a959004684b37a3dbccb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_dhx_passwd.c,v 1.14 2002-01-04 04:45:48 sibaz Exp $
+ * $Id: uams_dhx_passwd.c,v 1.15 2002-02-13 16:44:59 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -270,8 +270,8 @@ static int passwd_logincont(void *obj, struct passwd **uam_pwd,
         uam_afp_getcmdline( &ac, &av );
         sprintf( hostname, "%s@%s", dhxpwd->pw_name, clientname );
 
-        if( sia_validate_user( NULL, ac, av, hostname, dhxpwd->pw_name,
-                               NULL, FALSE, NULL, rbuf ) != SIASUCCESS )
+        if( uam_sia_validate_user( NULL, ac, av, hostname, dhxpwd->pw_name,
+                                   NULL, FALSE, NULL, rbuf ) != SIASUCCESS )
             return AFPERR_NOTAUTH;
 
         memset( rbuf, 0, PASSWDLEN );
index 44f8cac216d388eac2d3d8e3fb43466bc2126393..e423b674a9786ee86fda6d31f8de62129b4d70e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_passwd.c,v 1.15 2002-01-24 16:31:20 jmarcus Exp $
+ * $Id: uams_passwd.c,v 1.16 2002-02-13 16:44:59 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -138,8 +138,8 @@ static int passwd_login(void *obj, struct passwd **uam_pwd,
         uam_afp_getcmdline( &ac, &av );
         sprintf( hostname, "%s@%s", username, clientname );
 
-        if( sia_validate_user( NULL, ac, av, hostname, username,
-                               NULL, FALSE, NULL, ibuf ) != SIASUCCESS )
+        if( uams_sia_validate_user( NULL, ac, av, hostname, username,
+                                    NULL, FALSE, NULL, ibuf ) != SIASUCCESS )
             return AFPERR_NOTAUTH;
 
         return AFP_OK;
index 060bc228588f03b734a94e73fdae4a090b05e637..44847712ac53410ff1a309dcfbe07459e0940878 100644 (file)
@@ -9,6 +9,11 @@
 #include <pwd.h>
 #include <stdarg.h>
 
+#ifdef TRU64
+#include <sia.h>
+#include <siad.h>
+#endif /* TRU64 */
+
 /* just a label for exported bits */
 #define UAM_MODULE_EXPORT
 
@@ -64,6 +69,9 @@ extern int uam_afp_read __P((void *, char *, int *,
 extern int uam_afpserver_option __P((void *, const int, void *, int *));
 #ifdef TRU64
 extern void uam_afp_getcmdline __P((int *, char ***));
+extern int uam_sia_validate_user __P((sia_collect_func_t *, int, char **,
+                                     char *, char *, char *, int, char *,
+                                     char *));
 #endif /* TRU64 */
 
 /* switch.c */