|
Lines 37-42
Link Here
|
| 37 |
#include "newsrc.h" |
37 |
#include "newsrc.h" |
| 38 |
#include <sys/stat.h> |
38 |
#include <sys/stat.h> |
| 39 |
|
39 |
|
|
|
40 |
#ifdef DRAC_AUTH |
| 41 |
#include <netinet/in.h> |
| 42 |
#include <arpa/inet.h> |
| 43 |
#include <stdlib.h> |
| 44 |
#endif /* DRAC_AUTH */ |
| 40 |
|
45 |
|
| 41 |
#define CRLF PSOUT ("\015\012") /* primary output terpri */ |
46 |
#define CRLF PSOUT ("\015\012") /* primary output terpri */ |
| 42 |
|
47 |
|
|
Lines 207-212
Link Here
|
| 207 |
|
212 |
|
| 208 |
/* Global storage */ |
213 |
/* Global storage */ |
| 209 |
|
214 |
|
|
|
215 |
#ifdef DRAC_AUTH |
| 216 |
#define DRACTIMEOUT 10*60 /* check every 10 minutes */ |
| 217 |
time_t lastdrac = 0; /* time of last drac check */ |
| 218 |
extern char *getenv (); |
| 219 |
#endif /* DRAC_AUTH */ |
| 220 |
|
| 210 |
char *version = "404"; /* edit number of this server */ |
221 |
char *version = "404"; /* edit number of this server */ |
| 211 |
char *logout = "Logout"; /* syslogreason for logout */ |
222 |
char *logout = "Logout"; /* syslogreason for logout */ |
| 212 |
char *goodbye = NIL; /* bye reason */ |
223 |
char *goodbye = NIL; /* bye reason */ |
|
Lines 283-289
Link Here
|
| 283 |
msg_string_next, /* get next byte in string structure */ |
294 |
msg_string_next, /* get next byte in string structure */ |
| 284 |
msg_string_setpos /* set position in string structure */ |
295 |
msg_string_setpos /* set position in string structure */ |
| 285 |
}; |
296 |
}; |
| 286 |
|
297 |
|
|
|
298 |
#ifdef DRAC_AUTH |
| 299 |
/* DRAC Authorization |
| 300 |
*/ |
| 301 |
void drac_auth () |
| 302 |
{ |
| 303 |
if (time (0) > lastdrac + DRACTIMEOUT) |
| 304 |
{ |
| 305 |
FILE *dracconf; |
| 306 |
char host[100]; |
| 307 |
char *drachost; |
| 308 |
char *err; |
| 309 |
char *p; |
| 310 |
|
| 311 |
if ( (dracconf = fopen(ETC_DIR "/dracd.host", "r")) == NULL) |
| 312 |
{ |
| 313 |
syslog (LOG_INFO, "dracd: error opening %s/dracd.host config file",ETC_DIR); |
| 314 |
exit(1); |
| 315 |
} |
| 316 |
|
| 317 |
fgets(host, 100, dracconf); |
| 318 |
p = strchr(host, '\n'); |
| 319 |
if(p != NULL) |
| 320 |
*p = '\0'; |
| 321 |
fclose(dracconf); |
| 322 |
|
| 323 |
if( drachost = (host) ) |
| 324 |
{ |
| 325 |
struct sockaddr_in sin; |
| 326 |
int sinlen = sizeof (struct sockaddr_in); |
| 327 |
char *client = getpeername (0,(struct sockaddr *) &sin,(void *) &sinlen) ? |
| 328 |
"UNKNOWN" : inet_ntoa (sin.sin_addr); |
| 329 |
|
| 330 |
lastdrac = time(0); |
| 331 |
|
| 332 |
if (dracauth(drachost, inet_addr(client), &err) != 0) |
| 333 |
syslog (LOG_INFO, err); |
| 334 |
else |
| 335 |
syslog (LOG_INFO, "dracd: authorized ip %s", client); |
| 336 |
} |
| 337 |
} |
| 338 |
} |
| 339 |
#endif /* DRAC_AUTH */ |
| 340 |
|
| 287 |
/* Main program */ |
341 |
/* Main program */ |
| 288 |
|
342 |
|
| 289 |
int main (int argc,char *argv[]) |
343 |
int main (int argc,char *argv[]) |
|
Lines 1525-1530
Link Here
|
| 1525 |
lasterror ()); |
1579 |
lasterror ()); |
| 1526 |
return; |
1580 |
return; |
| 1527 |
} |
1581 |
} |
|
|
1582 |
#ifdef DRAC_AUTH |
| 1583 |
drac_auth(); |
| 1584 |
#endif /* DRAC_AUTH */ |
| 1528 |
/* change in number of messages? */ |
1585 |
/* change in number of messages? */ |
| 1529 |
if (existsquelled || (nmsgs != stream->nmsgs)) { |
1586 |
if (existsquelled || (nmsgs != stream->nmsgs)) { |
| 1530 |
PSOUT ("* "); |
1587 |
PSOUT ("* "); |