Check a login name and password against the UUCP password file.
Copyright (C) 1992 Ian Lance Taylor
This file is part of the Taylor UUCP uuconf library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
const char _uuconf_callin_rcsid
[] = "$Id: callin.c,v 1.1 1993/08/04 19:33:42 jtc Exp $";
static int iplogin
P((pointer pglobal
, int argc
, char **argv
,
pointer pvar
, pointer pinfo
));
/* Check a login name and password against the UUCP password file.
This looks at the Taylor UUCP password file, but will work even if
uuconf_taylor_init was not called. */
uuconf_callin (pglobal
, zlogin
, zpassword
)
struct sglobal
*qglobal
= (struct sglobal
*) pglobal
;
struct uuconf_cmdtab as
[2];
/* If we have no password file names, fill in the default name. */
if (qglobal
->qprocess
->pzpwdfiles
== NULL
)
char ab
[sizeof NEWCONFIGLIB
+ sizeof PASSWDFILE
- 1];
memcpy ((pointer
) ab
, (pointer
) NEWCONFIGLIB
,
sizeof NEWCONFIGLIB
- 1);
memcpy ((pointer
) (ab
+ sizeof NEWCONFIGLIB
- 1), (pointer
) PASSWDFILE
,
iret
= _uuconf_iadd_string (qglobal
, ab
, TRUE
, FALSE
,
&qglobal
->qprocess
->pzpwdfiles
,
if (iret
!= UUCONF_SUCCESS
)
as
[0].uuconf_zcmd
= zlogin
;
as
[0].uuconf_itype
= UUCONF_CMDTABTYPE_FN
| 2;
as
[0].uuconf_pvar
= (pointer
) &zfilepass
;
as
[0].uuconf_pifn
= iplogin
;
as
[1].uuconf_zcmd
= NULL
;
for (pz
= qglobal
->qprocess
->pzpwdfiles
; *pz
!= NULL
; pz
++)
iret
= UUCONF_FOPEN_FAILED
| UUCONF_ERROR_ERRNO
;
iret
= uuconf_cmd_file (pglobal
, e
, as
, (pointer
) NULL
,
UUCONF_CMDTABFLAG_CASE
, (pointer
) NULL
);
if (iret
!= UUCONF_SUCCESS
|| zfilepass
!= NULL
)
if (iret
!= UUCONF_SUCCESS
)
qglobal
->zfilename
= *pz
;
iret
|= UUCONF_ERROR_FILENAME
;
else if (zfilepass
== NULL
|| strcmp (zfilepass
, zpassword
) != 0)
free ((pointer
) zfilepass
);
/* This is called if it is the name we are looking for. The pvar
argument points to zfilepass, and we set it to the password. */
iplogin (pglobal
, argc
, argv
, pvar
, pinfo
)
struct sglobal
*qglobal
= (struct sglobal
*) pglobal
;
char **pzpass
= (char **) pvar
;
*pzpass
= strdup (argv
[1]);
return (UUCONF_MALLOC_FAILED
| UUCONF_CMDTABRET_EXIT
);
return UUCONF_CMDTABRET_EXIT
;