From d53755639af5ffd3b2543eb1e39e2dda262e530d Mon Sep 17 00:00:00 2001 From: rufustfirefly Date: Thu, 3 May 2001 13:57:44 +0000 Subject: [PATCH] Tru64 fixes from Burkhard Schmidt --- etc/afpd/main.c | 6 ++++++ etc/afpd/quota.c | 16 ++++++++++++++++ etc/afpd/unix.h | 10 +++++++++- etc/uams/uams_passwd.c | 23 +++++++++++++++++++++-- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/etc/afpd/main.c b/etc/afpd/main.c index 7f273c23..603d663f 100644 --- a/etc/afpd/main.c +++ b/etc/afpd/main.c @@ -1,4 +1,6 @@ /* + * $Id: main.c,v 1.5 2001-05-03 13:57:44 rufustfirefly Exp $ + * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. */ @@ -126,6 +128,10 @@ int main( ac, av ) struct sigaction sv; sigset_t sigs; +#ifdef DIGITAL_UNIX_SECURITY + set_auth_parameters( ac, av ); +#endif /* DIGITAL_UNIX_SECURITY */ + umask( 0 ); /* so inherited file permissions work right */ afp_options_init(&default_options); diff --git a/etc/afpd/quota.c b/etc/afpd/quota.c index 6a68d6a2..522fff9f 100644 --- a/etc/afpd/quota.c +++ b/etc/afpd/quota.c @@ -1,4 +1,6 @@ /* + * $Id: quota.c,v 1.4 2001-05-03 13:57:44 rufustfirefly Exp $ + * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. */ @@ -199,11 +201,13 @@ static int getfsquota(vol, uid, dq) #define QCMD(a,b) (a) #endif +#ifndef TRU64 /* for group quotas. we only use these if the user belongs * to one group. */ struct dqblk dqg; memset(&dqg, 0, sizeof(dqg)); +#endif /* TRU64 */ #ifdef BSD4_4 if ( quotactl( vol->v_gvs, QCMD(Q_GETQUOTA,USRQUOTA), @@ -215,6 +219,15 @@ static int getfsquota(vol, uid, dq) quotactl(vol->v_gvs, QCMD(Q_GETQUOTA, GRPQUOTA), groups[0], (char *) &dqg); +#elif defined(TRU64) + if ( seteuid( getuid() ) == 0 ) { + if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA, USRQUOTA), + uid, (char *)dq ) != 0 ) { + seteuid( uid ); + return ( AFPERR_PARAM ); + } + } + #else /* BSD4_4 */ if ( quotactl(QCMD(Q_GETQUOTA, USRQUOTA), vol->v_gvs, uid, (caddr_t) dq ) != 0 ) { @@ -226,6 +239,7 @@ static int getfsquota(vol, uid, dq) groups[0], (char *) &dqg); #endif /* BSD4_4 */ +#ifndef TRU64 /* set stuff up for group quotas if necessary */ /* max(user blocks, group blocks) */ @@ -247,6 +261,8 @@ static int getfsquota(vol, uid, dq) (dq->dqb_btimelimit > dqg.dqb_btimelimit))) dq->dqb_btimelimit = dqg.dqb_btimelimit; +#endif /* TRU64 */ + #endif /* ultrix */ #endif /* __svr4__ */ diff --git a/etc/afpd/unix.h b/etc/afpd/unix.h index f6b29945..0f677108 100644 --- a/etc/afpd/unix.h +++ b/etc/afpd/unix.h @@ -1,3 +1,7 @@ +/* + * $Id: unix.h,v 1.3 2001-05-03 13:57:44 rufustfirefly Exp $ + */ + #ifndef AFPD_UNIX_H #define AFPD_UNIX_H @@ -35,8 +39,12 @@ typedef int mode_t; #include #define statfs statvfs #else +#if defined(TRU64) +#define f_frsize f_fsize +#else /* TRU64 */ #define f_frsize f_bsize -#endif +#endif /* TRU64 */ +#endif /* USE_STATVFS_H */ #if defined(__svr4__) || defined(USE_MNTTAB_H) #include diff --git a/etc/uams/uams_passwd.c b/etc/uams/uams_passwd.c index 83cf7d1b..ea8fb531 100644 --- a/etc/uams/uams_passwd.c +++ b/etc/uams/uams_passwd.c @@ -1,5 +1,5 @@ /* - * $Id: uams_passwd.c,v 1.6 2001-02-27 17:07:43 rufustfirefly Exp $ + * $Id: uams_passwd.c,v 1.7 2001-05-03 13:57:44 rufustfirefly Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) @@ -33,6 +33,12 @@ #define PASSWDLEN 8 +#ifdef DIGITAL_UNIX_SECURITY +#include +#include +#include +#endif /* DIGITAL_UNIX_SECURITY */ + /* cleartxt login */ static int passwd_login(void *obj, struct passwd **uam_pwd, char *ibuf, int ibuflen, @@ -41,9 +47,13 @@ static int passwd_login(void *obj, struct passwd **uam_pwd, struct passwd *pwd; #ifdef SHADOWPW struct spwd *sp; -#endif +#endif /* SHADOWPW */ char *username, *p; int len, ulen; +#ifdef DIGITAL_UNIX_SECURITY + char *bigcrypt(); + struct pr_passwd *pr; +#endif /* DIGITAL_UNIX_SECURITY */ *rbuflen = 0; @@ -84,9 +94,18 @@ static int passwd_login(void *obj, struct passwd **uam_pwd, *uam_pwd = pwd; +#ifdef DIGITAL_UNIX_SECURITY + pr = getprpwnam( username ); + if ( pr == NULL ) + return AFPERR_NOTAUTH; + if ( strcmp ( bigcrypt ( ibuf, pr->ufld.fd_encrypt ), + pr->ufld.fd_encrypt == 0 ) + return AFP_OK; +#else /* DIGITAL_UNIX_SECURITY */ p = crypt( ibuf, pwd->pw_passwd ); if ( strcmp( p, pwd->pw_passwd ) == 0 ) return AFP_OK; +#endif /* DIGITAL_UNIX_SECURITY */ return AFPERR_NOTAUTH; } -- 2.39.2