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
29 #include <afs/comauth.h>
30 #include <sys/types.h>
31 #include <netinet/in.h>
32 #include <afs/cellconfig.h>
38 afs_changepw( ibuf, ibuflen, rbuf, rbuflen )
40 int ibuflen, *rbuflen;
42 char cell[ MAXCELLCHARS ], name[ 20 ], oldpw[ 10 ], newpw[ 10 ];
47 len = (unsigned char )*ibuf++;
49 if (( p = strchr( ibuf, '@' )) != NULL ) {
54 if ( GetLocalCellName() != CCONF_SUCCESS ) {
56 return( AFPERR_BADUAM );
58 strcpy( cell, LclCellName );
61 if ( strlen( ibuf ) > 20 ) {
63 return( AFPERR_PARAM );
69 if (U_InitRPC() != 0) {
71 return( AFPERR_BADUAM );
74 memcpy( &clen, ibuf, sizeof( clen ));
75 ibuf += sizeof( short );
76 pcbc_encrypt((C_Block *)ibuf, (C_Block *)ibuf,
77 clen, seskeysched, seskey, 0 );
79 len = (unsigned char) *ibuf++;
82 return( AFPERR_PARAM );
84 memcpy( oldpw, ibuf, len );
87 len = (unsigned char) *ibuf++;
90 return( AFPERR_PARAM );
92 memcpy( newpw, ibuf, len );
95 rc = U_CellChangePassword( name, newpw, name, oldpw, cell ) != 0 ) {
99 if ( rc < 0 && r_errno = R_ERROR ) {
100 return( AFPERR_NOTAUTH );
102 return( AFPERR_BADUAM );