2 * $Id: passwd.c,v 1.3 2001-06-20 18:33:04 rufustfirefly 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 */
35 #include <afs/comauth.h>
36 #include <sys/types.h>
37 #include <netinet/in.h>
38 #include <afs/cellconfig.h>
44 afs_changepw( ibuf, ibuflen, rbuf, rbuflen )
46 int ibuflen, *rbuflen;
48 char cell[ MAXCELLCHARS ], name[ 20 ], oldpw[ 10 ], newpw[ 10 ];
53 len = (unsigned char )*ibuf++;
55 if (( p = strchr( ibuf, '@' )) != NULL ) {
60 if ( GetLocalCellName() != CCONF_SUCCESS ) {
62 return( AFPERR_BADUAM );
64 strcpy( cell, LclCellName );
67 if ( strlen( ibuf ) > 20 ) {
69 return( AFPERR_PARAM );
75 if (U_InitRPC() != 0) {
77 return( AFPERR_BADUAM );
80 memcpy( &clen, ibuf, sizeof( clen ));
81 ibuf += sizeof( short );
82 pcbc_encrypt((C_Block *)ibuf, (C_Block *)ibuf,
83 clen, seskeysched, seskey, 0 );
85 len = (unsigned char) *ibuf++;
88 return( AFPERR_PARAM );
90 memcpy( oldpw, ibuf, len );
93 len = (unsigned char) *ibuf++;
96 return( AFPERR_PARAM );
98 memcpy( newpw, ibuf, len );
101 rc = U_CellChangePassword( name, newpw, name, oldpw, cell ) != 0 ) {
105 if ( rc < 0 && r_errno = R_ERROR ) {
106 return( AFPERR_NOTAUTH );
108 return( AFPERR_BADUAM );