imapext-2007
diff src/osdep/unix/ckp_os4.c @ 0:ada5e610ab86
imap-2007e
author | yuuji@gentei.org |
---|---|
date | Mon, 14 Sep 2009 15:17:45 +0900 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/osdep/unix/ckp_os4.c Mon Sep 14 15:17:45 2009 +0900 1.3 @@ -0,0 +1,78 @@ 1.4 +/* ======================================================================== 1.5 + * Copyright 1988-2006 University of Washington 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * 1.14 + * ======================================================================== 1.15 + */ 1.16 + 1.17 +/* 1.18 + * Program: OSF/1 (Digital UNIX) 4 check password 1.19 + * 1.20 + * Author: Mark Crispin 1.21 + * Networks and Distributed Computing 1.22 + * Computing & Communications 1.23 + * University of Washington 1.24 + * Administration Building, AG-44 1.25 + * Seattle, WA 98195 1.26 + * Internet: MRC@CAC.Washington.EDU 1.27 + * 1.28 + * Date: 1 August 1988 1.29 + * Last Edited: 30 August 2006 1.30 + */ 1.31 + 1.32 +/* Dummy collection routine 1.33 + * Accepts: how long to wait for user 1.34 + * how to run parameter collection 1.35 + * title 1.36 + * number of prompts 1.37 + * prompts 1.38 + * Returns: collection status 1.39 + * 1.40 + * Because Spider Boardman, who wrote SIA, says that it's needed for buggy SIA 1.41 + * mechanisms, that's why. 1.42 + */ 1.43 + 1.44 +static int checkpw_collect (int timeout,int rendition,uchar_t *title, 1.45 + int nprompts,prompt_t *prompts) 1.46 +{ 1.47 + switch (rendition) { 1.48 + case SIAONELINER: case SIAINFO: case SIAWARNING: return SIACOLSUCCESS; 1.49 + } 1.50 + return SIACOLABORT; /* another else is bogus */ 1.51 +} 1.52 + 1.53 + 1.54 +/* Check password 1.55 + * Accepts: login passwd struct 1.56 + * password string 1.57 + * argument count 1.58 + * argument vector 1.59 + * Returns: passwd struct if password validated, NIL otherwise 1.60 + */ 1.61 + 1.62 +struct passwd *checkpw (struct passwd *pw,char *pass,int argc,char *argv[]) 1.63 +{ 1.64 + int i; 1.65 + char *s; 1.66 + char *name = cpystr (pw->pw_name); 1.67 + char *host = cpystr (tcp_clienthost ()); 1.68 + struct passwd *ret = NIL; 1.69 + /* tie off address */ 1.70 + if (s = strchr (host,' ')) *s = '\0'; 1.71 + if (*host == '[') { /* convert [a.b.c.d] to a.b.c.d */ 1.72 + memmove (host,host+1,i = strlen (host + 2)); 1.73 + host[i] = '\0'; 1.74 + } 1.75 + /* validate password */ 1.76 + if (sia_validate_user (checkpw_collect,argc,argv,host,name,NIL,NIL,NIL,pass) 1.77 + == SIASUCCESS) ret = getpwnam (name); 1.78 + fs_give ((void **) &name); 1.79 + fs_give ((void **) &host); 1.80 + return ret; 1.81 +}