2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
5 * Permission to use, copy, modify, and distribute this software and
6 * its documentation for any purpose and without fee is hereby granted,
7 * provided that the above copyright notice appears in all copies and
8 * that both that copyright notice and this permission notice appear
9 * in supporting documentation, and that the name of The University
10 * of Michigan not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. This software is supplied as is without expressed or
13 * implied warranties of any kind.
15 * Research Systems Unix Group
16 * The University of Michigan
18 * 535 W. William Street
21 * netatalk@itd.umich.edu
33 #include <afs/comauth.h>
34 #include <sys/types.h>
35 #include <netinet/in.h>
36 #include <afs/cellconfig.h>
42 afs_changepw( ibuf, ibuflen, rbuf, rbuflen )
44 int ibuflen, *rbuflen;
46 char cell[ MAXCELLCHARS ], name[ 20 ], oldpw[ 10 ], newpw[ 10 ];
51 len = (unsigned char )*ibuf++;
53 if (( p = strchr( ibuf, '@' )) != NULL ) {
58 if ( GetLocalCellName() != CCONF_SUCCESS ) {
60 return( AFPERR_BADUAM );
62 strcpy( cell, LclCellName );
65 if ( strlen( ibuf ) > 20 ) {
67 return( AFPERR_PARAM );
73 if (U_InitRPC() != 0) {
75 return( AFPERR_BADUAM );
78 memcpy( &clen, ibuf, sizeof( clen ));
79 ibuf += sizeof( short );
80 pcbc_encrypt((C_Block *)ibuf, (C_Block *)ibuf,
81 clen, seskeysched, seskey, 0 );
83 len = (unsigned char) *ibuf++;
86 return( AFPERR_PARAM );
88 memcpy( oldpw, ibuf, len );
91 len = (unsigned char) *ibuf++;
94 return( AFPERR_PARAM );
96 memcpy( newpw, ibuf, len );
99 rc = U_CellChangePassword( name, newpw, name, oldpw, cell ) != 0 ) {
103 if ( rc < 0 && r_errno = R_ERROR ) {
104 return( AFPERR_NOTAUTH );
106 return( AFPERR_BADUAM );