|
Line
Link Here
|
|
-- ezbounce-1.04a/mdidentd/identd.cpp |
|
|
|
Lines 44-49
Link Here
|
| 44 |
|
44 |
|
| 45 |
#include <unistd.h> |
45 |
#include <unistd.h> |
| 46 |
#include <sys/socket.h> |
46 |
#include <sys/socket.h> |
|
|
47 |
#include <pwd.h> |
| 47 |
#include <sys/types.h> |
48 |
#include <sys/types.h> |
| 48 |
#include <sys/stat.h> |
49 |
#include <sys/stat.h> |
| 49 |
#include <arpa/inet.h> |
50 |
#include <arpa/inet.h> |
|
Lines 76-81
Link Here
|
| 76 |
static bool foreground, auto_kill; /* Some options */ |
77 |
static bool foreground, auto_kill; /* Some options */ |
| 77 |
bool no_real; |
78 |
bool no_real; |
| 78 |
static uid_t uid; /* Become this user after binding sock */ |
79 |
static uid_t uid; /* Become this user after binding sock */ |
|
|
80 |
static gid_t gid; /* Primary group of uid */ |
| 79 |
static unsigned int hard_limit; /* Max # of fake idents */ |
81 |
static unsigned int hard_limit; /* Max # of fake idents */ |
| 80 |
static unsigned int num_conns; |
82 |
static unsigned int num_conns; |
| 81 |
static unsigned int num_unix; |
83 |
static unsigned int num_unix; |
|
Lines 179-188
Link Here
|
| 179 |
id = argv[y+1]; |
181 |
id = argv[y+1]; |
| 180 |
if (!id) |
182 |
if (!id) |
| 181 |
{ |
183 |
{ |
| 182 |
fprintf(stderr, "Option '-u' requires numeric user id to follow it\n"); |
184 |
fprintf(stderr, "Option '-u' requires user id to follow it\n"); |
| 183 |
exit(1); |
185 |
exit(1); |
| 184 |
} |
186 |
} |
| 185 |
uid = (uid_t) atoi(id); |
187 |
struct passwd *pw_ent; |
|
|
188 |
if (!(pw_ent = getpwnam(id))) { |
| 189 |
fprintf(stderr, "Option '-u' requires valid user id to follow it\n"); |
| 190 |
exit(1); |
| 191 |
} |
| 192 |
uid = pw_ent->pw_uid; |
| 193 |
gid = pw_ent->pw_gid; |
| 186 |
y++; |
194 |
y++; |
| 187 |
break; |
195 |
break; |
| 188 |
case 'h': |
196 |
case 'h': |
|
Lines 277-285
Link Here
|
| 277 |
unix_listen_fd = -1; |
285 |
unix_listen_fd = -1; |
| 278 |
return 0; |
286 |
return 0; |
| 279 |
} |
287 |
} |
| 280 |
/* Must make it world writable if we expect to receive connections |
|
|
| 281 |
on it */ |
| 282 |
fchmod(unix_listen_fd, 0777); |
| 283 |
return 1; |
288 |
return 1; |
| 284 |
} |
289 |
} |
| 285 |
|
290 |
|
|
Lines 396-402
Link Here
|
| 396 |
* see if matches any of our fake ones, if not.. |
401 |
* see if matches any of our fake ones, if not.. |
| 397 |
* its time to load the user's other identd. |
402 |
* its time to load the user's other identd. |
| 398 |
* |
403 |
* |
| 399 |
* Currently replies system name as 'OTHER'. |
404 |
* Currently replies system name as 'UNIX'. |
| 400 |
*/ |
405 |
*/ |
| 401 |
static int reply(conn * c) |
406 |
static int reply(conn * c) |
| 402 |
{ |
407 |
{ |
|
Lines 422-429
Link Here
|
| 422 |
if (table->lookup(p1, p2, ident, sizeof(ident))) |
427 |
if (table->lookup(p1, p2, ident, sizeof(ident))) |
| 423 |
{ |
428 |
{ |
| 424 |
syslog(LOG_INFO, "Request from %s for: %d , %d ", inet_ntoa(sin.sin_addr), p1, p2); |
429 |
syslog(LOG_INFO, "Request from %s for: %d , %d ", inet_ntoa(sin.sin_addr), p1, p2); |
| 425 |
syslog(LOG_INFO, "(fake) reply: %d, %d : USERID : OTHER :%s", p1, p2, ident); |
430 |
syslog(LOG_INFO, "(fake) reply: %d , %d : USERID : UNIX : %s", p1, p2, ident); |
| 426 |
fdprintf(c->fd, "%d , %d : USERID : OTHER :%s\r\n", |
431 |
fdprintf(c->fd, "%d , %d : USERID : UNIX : %s\r\n", |
| 427 |
p1, p2, ident); |
432 |
p1, p2, ident); |
| 428 |
if (auto_kill) |
433 |
if (auto_kill) |
| 429 |
table->remove(p1, p2, ident); |
434 |
table->remove(p1, p2, ident); |
|
Lines 491-497
Link Here
|
| 491 |
/* we already did this. but it doesn't work. i dunno why. |
496 |
/* we already did this. but it doesn't work. i dunno why. |
| 492 |
* i am messing up somwhere. dunno where. but we will do it again. |
497 |
* i am messing up somwhere. dunno where. but we will do it again. |
| 493 |
* and it will work. so there!! */ |
498 |
* and it will work. so there!! */ |
| 494 |
chmod(MDIDENTD_SOCK_PATH, 0777); |
499 |
chmod(MDIDENTD_SOCK_PATH, 0770); |
|
|
500 |
chown(MDIDENTD_SOCK_PATH, uid, gid); |
| 495 |
#ifndef NOFORK |
501 |
#ifndef NOFORK |
| 496 |
if (!foreground) |
502 |
if (!foreground) |
| 497 |
{ |
503 |
{ |