1 /* ========================================================================
2 * Copyright 1988-2006 University of Washington
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
11 * ========================================================================
15 * Program: OSF/1 (Digital UNIX) 4 check password
17 * Author: Mark Crispin
18 * Networks and Distributed Computing
19 * Computing & Communications
20 * University of Washington
21 * Administration Building, AG-44
23 * Internet: MRC@CAC.Washington.EDU
26 * Last Edited: 30 August 2006
29 /* Dummy collection routine
30 * Accepts: how long to wait for user
31 * how to run parameter collection
35 * Returns: collection status
37 * Because Spider Boardman, who wrote SIA, says that it's needed for buggy SIA
38 * mechanisms, that's why.
41 static int checkpw_collect (int timeout
,int rendition
,uchar_t
*title
,
42 int nprompts
,prompt_t
*prompts
)
45 case SIAONELINER
: case SIAINFO
: case SIAWARNING
: return SIACOLSUCCESS
;
47 return SIACOLABORT
; /* another else is bogus */
52 * Accepts: login passwd struct
56 * Returns: passwd struct if password validated, NIL otherwise
59 struct passwd
*checkpw (struct passwd
*pw
,char *pass
,int argc
,char *argv
[])
63 char *name
= cpystr (pw
->pw_name
);
64 char *host
= cpystr (tcp_clienthost ());
65 struct passwd
*ret
= NIL
;
67 if (s
= strchr (host
,' ')) *s
= '\0';
68 if (*host
== '[') { /* convert [a.b.c.d] to a.b.c.d */
69 memmove (host
,host
+1,i
= strlen (host
+ 2));
72 /* validate password */
73 if (sia_validate_user (checkpw_collect
,argc
,argv
,host
,name
,NIL
,NIL
,NIL
,pass
)
74 == SIASUCCESS
) ret
= getpwnam (name
);
75 fs_give ((void **) &name
);
76 fs_give ((void **) &host
);