Legend:
- Unmodified
- Added
- Removed
-
icbd.c
r2be3612 r4a74b5b 2 2 * Copyright (c) 2009 Mike Belopuhov 3 3 * Copyright (c) 2007 Oleg Safiullin 4 * Copyright (c) 2024 Nishi 5 * Copyright (C) 2025 Izuru Yakumo 4 6 * 5 7 * Permission to use, copy, modify, and distribute this software for any … … 175 177 hints.ai_socktype = SOCK_STREAM; 176 178 hints.ai_flags = AI_PASSIVE; 179 #ifdef __OpenBSD__ 180 /* Apparently OpenBSD is the only one that has icb on /etc/services */ 181 /* Sure, it could be easily added to any other system, but I'm personally against it */ 182 /* ~Izuru Yakumo */ 177 183 if ((error = getaddrinfo(addr, port ? port : "icb", &hints, 178 184 &res0)) != 0) { … … 180 186 return (EX_UNAVAILABLE); 181 187 } 182 188 #else 189 if ((error = getaddrinfo(addr, port ? port : "7326", &hints, &res0)) != 0) { 190 syslog(LOG_ERR, "%s", gai_strerror(error)); 191 return (EX_UNAVAILABLE); 192 } 193 #endif 183 194 for (res = res0; res != NULL; res = res->ai_next) { 184 195 if ((s = socket(res->ai_family, res->ai_socktype, … … 476 487 exit(EX_NOPERM); 477 488 } 478 489 #ifdef __OpenBSD__ 479 490 if (sb.st_uid != 0 || (sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) { 480 491 syslog(LOG_ERR, "bad directory permissions"); 481 492 exit(EX_NOPERM); 482 493 } 483 484 494 if (chroot(pw->pw_dir) < 0) { 485 495 syslog(LOG_ERR, "%s: %m", pw->pw_dir); … … 493 503 494 504 chdir(ICBD_HOME); 495 505 #endif 496 506 if (setuid(pw->pw_uid) < 0) { 497 507 syslog(LOG_ERR, "%d: %m", pw->pw_uid); … … 499 509 } 500 510 511 #ifdef __OpenBSD__ 501 512 if (dodns) { 502 513 if (pledge("stdio inet rpath dns", NULL) == -1) { … … 510 521 } 511 522 } 523 #endif 512 524 513 525 (void)setproctitle("icbd");
Note:
See TracChangeset
for help on using the changeset viewer.