comparison lib-src/pop.c @ 384:bbff43aa5eb7 r21-2-7

Import from CVS: tag r21-2-7
author cvs
date Mon, 13 Aug 2007 11:08:24 +0200
parents c5d627a313b1
children 74fd4e045ea6
comparison
equal deleted inserted replaced
383:6a50c6a581a5 384:bbff43aa5eb7
36 #undef close 36 #undef close
37 #endif 37 #endif
38 38
39 #include <sys/types.h> 39 #include <sys/types.h>
40 #ifdef WINDOWSNT 40 #ifdef WINDOWSNT
41 #include "ntlib.h"
42 #include <winsock.h> 41 #include <winsock.h>
43 #undef SOCKET_ERROR 42 #undef SOCKET_ERROR
44 #define RECV(s,buf,len,flags) recv(s,buf,len,flags) 43 #define RECV(s,buf,len,flags) recv(s,buf,len,flags)
45 #define SEND(s,buf,len,flags) send(s,buf,len,flags) 44 #define SEND(s,buf,len,flags) send(s,buf,len,flags)
46 #define CLOSESOCKET(s) closesocket(s) 45 #define CLOSESOCKET(s) closesocket(s)
75 74
76 #include <unistd.h> 75 #include <unistd.h>
77 #include <sys/stat.h> 76 #include <sys/stat.h>
78 #include <sys/file.h> 77 #include <sys/file.h>
79 #include "../src/syswait.h" 78 #include "../src/syswait.h"
79 #ifndef WINDOWSNT
80 #include "../src/systime.h" 80 #include "../src/systime.h"
81 #endif
81 #include <stdlib.h> 82 #include <stdlib.h>
82 #include <string.h> 83 #include <string.h>
83 84
84 #ifdef KERBEROS 85 #ifdef KERBEROS
85 #ifndef KRB5 86 #ifndef KRB5
181 if (! username) 182 if (! username)
182 { 183 {
183 username = getenv ("USER"); 184 username = getenv ("USER");
184 if (! (username && *username)) 185 if (! (username && *username))
185 { 186 {
187 #ifndef WINDOWSNT
186 username = getlogin (); 188 username = getlogin ();
187 if (! (username && *username)) 189 if (! (username && *username))
188 { 190 {
189 struct passwd *passwd; 191 struct passwd *passwd;
190 passwd = getpwuid (getuid ()); 192 passwd = getpwuid (getuid ());
196 { 198 {
197 strcpy (pop_error, "Could not determine username"); 199 strcpy (pop_error, "Could not determine username");
198 return (0); 200 return (0);
199 } 201 }
200 } 202 }
203 #else
204 strcpy (pop_error, "Could not determine username");
205 return (0);
206 #endif
201 } 207 }
202 } 208 }
203 209
204 /* 210 /*
205 * Determine the mail host. 211 * Determine the mail host.
245 #define DONT_NEED_PASSWORD 0 251 #define DONT_NEED_PASSWORD 0
246 #endif 252 #endif
247 253
248 if ((! password) && (! DONT_NEED_PASSWORD)) 254 if ((! password) && (! DONT_NEED_PASSWORD))
249 { 255 {
256 #ifndef WINDOWSNT
250 if (! (flags & POP_NO_GETPASS)) 257 if (! (flags & POP_NO_GETPASS))
251 { 258 {
252 password = getpass ("Enter POP password:"); 259 password = getpass ("Enter POP password:");
253 } 260 }
261 #endif
254 if (! password) 262 if (! password)
255 { 263 {
256 strcpy (pop_error, "Could not determine POP password"); 264 strcpy (pop_error, "Could not determine POP password");
257 return (0); 265 return (0);
258 } 266 }