1 /* ========================================================================
2 * Copyright 2008 Mark Crispin
3 * ========================================================================
7 * Program: Dummy (no SSL) authentication/encryption module
11 * Date: 7 February 2001
12 * Last Edited: 19 November 2008
14 * Previous versions of this file were
16 * Copyright 1988-2006 University of Washington
18 * Licensed under the Apache License, Version 2.0 (the "License");
19 * you may not use this file except in compliance with the License.
20 * You may obtain a copy of the License at
22 * http://www.apache.org/licenses/LICENSE-2.0
26 /* Init server for SSL
27 * Accepts: server name
30 void ssl_server_init (char *server
)
32 syslog (LOG_ERR
,"This server does not support SSL");
33 exit (1); /* punt this program too */
38 * Accepts: /etc/services service name
39 * Returns: cpystr'd error string if TLS failed, else NIL for success
42 char *ssl_start_tls (char *server
)
44 return cpystr ("This server does not support TLS");
48 * Returns: character or EOF
57 } while ((ret
== EOF
) && !feof (stdin
) && ferror (stdin
) &&(errno
== EINTR
));
63 * Accepts: destination string pointer
64 * number of bytes available
65 * Returns: destination string pointer or NIL if EOF
68 char *PSIN (char *s
,int n
)
73 ret
= fgets (s
,n
,stdin
);
74 } while (!ret
&& !feof (stdin
) && ferror (stdin
) && (errno
== EINTR
));
80 * Accepts: destination string pointer
81 * number of bytes to read
82 * Returns: T if success, NIL otherwise
85 long PSINR (char *s
,unsigned long n
)
88 while (n
&& ((i
= fread (s
,1,n
,stdin
)) || (errno
== EINTR
))) s
+= i
,n
-= i
;
89 return n
? NIL
: LONGT
;
94 * Accepts: timeout in seconds
95 * Returns: T if have input on stdin, else NIL
98 long INWAIT (long seconds
)
100 return server_input_wait (seconds
);
105 * Returns: character written or EOF
115 * Accepts: source string pointer
116 * Returns: 0 or EOF if error
121 return fputs (s
,stdout
);
126 * Accepts: source sized text
127 * Returns: 0 or EOF if error
130 int PSOUTR (SIZEDTEXT
*s
)
134 for (t
= s
->data
,i
= s
->size
;
135 (i
&& ((j
= fwrite (t
,1,i
,stdout
)) || (errno
== EINTR
)));
137 return i
? EOF
: NIL
;
142 * Returns: 0 or EOF if error
147 return fflush (stdout
);