2 * $Id: passwd.c,v 1.4.2.1 2001-12-03 05:01:04 jmarcus Exp $
4 * Copyright (c) 1990,1991 Regents of The University of Michigan.
7 * Permission to use, copy, modify, and distribute this software and
8 * its documentation for any purpose and without fee is hereby granted,
9 * provided that the above copyright notice appears in all copies and
10 * that both that copyright notice and this permission notice appear
11 * in supporting documentation, and that the name of The University
12 * of Michigan not be used in advertising or publicity pertaining to
13 * distribution of the software without specific, written prior
14 * permission. This software is supplied as is without expressed or
15 * implied warranties of any kind.
17 * Research Systems Unix Group
18 * The University of Michigan
20 * 535 W. William Street
23 * netatalk@itd.umich.edu
28 #endif /* HAVE_CONFIG_H */
36 #else /* STDC_HEADERS */
40 #endif /* HAVE_STRCHR */
41 char *strchr (), *strrchr ();
43 #define memcpy(d,s,n) bcopy ((s), (d), (n))
44 #define memmove(d,s,n) bcopy ((s), (d), (n))
45 #endif /* ! HAVE_MEMCPY */
46 #endif /* STDC_HEADERS */
50 #include <afs/comauth.h>
51 #include <sys/types.h>
52 #include <netinet/in.h>
53 #include <afs/cellconfig.h>
59 afs_changepw( ibuf, ibuflen, rbuf, rbuflen )
61 int ibuflen, *rbuflen;
63 char cell[ MAXCELLCHARS ], name[ 20 ], oldpw[ 10 ], newpw[ 10 ];
68 len = (unsigned char )*ibuf++;
70 if (( p = strchr( ibuf, '@' )) != NULL ) {
75 if ( GetLocalCellName() != CCONF_SUCCESS ) {
77 return( AFPERR_BADUAM );
79 strcpy( cell, LclCellName );
82 if ( strlen( ibuf ) > 20 ) {
84 return( AFPERR_PARAM );
90 if (U_InitRPC() != 0) {
92 return( AFPERR_BADUAM );
95 memcpy( &clen, ibuf, sizeof( clen ));
96 ibuf += sizeof( short );
97 pcbc_encrypt((C_Block *)ibuf, (C_Block *)ibuf,
98 clen, seskeysched, seskey, 0 );
100 len = (unsigned char) *ibuf++;
103 return( AFPERR_PARAM );
105 memcpy( oldpw, ibuf, len );
108 len = (unsigned char) *ibuf++;
111 return( AFPERR_PARAM );
113 memcpy( newpw, ibuf, len );
116 rc = U_CellChangePassword( name, newpw, name, oldpw, cell ) != 0 ) {
120 if ( rc < 0 && r_errno = R_ERROR ) {
121 return( AFPERR_NOTAUTH );
123 return( AFPERR_BADUAM );