1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
|
/*
* ProFTPD: mod_ctrls -- a module implementing the ftpdctl local socket
* server, as well as several utility functions for other Controls
* modules
* Copyright (c) 2000-2022 TJ Saunders
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*
* As a special exemption, TJ Saunders and other respective copyright holders
* give permission to link this program with OpenSSL, and distribute the
* resulting executable, without including the source code for OpenSSL in the
* source distribution.
*
* This is mod_ctrls, contrib software for proftpd 1.3.x and above.
* For more information contact TJ Saunders <tj@castaglia.org>.
*/
#include "conf.h"
#include "privs.h"
#include "mod_ctrls.h"
#define MOD_CTRLS_VERSION "mod_ctrls/0.9.5"
#ifndef PR_USE_CTRLS
# error "Controls support required (use --enable-ctrls)"
#endif
/* Master daemon in standalone mode? (from src/main.c) */
extern unsigned char is_master;
module ctrls_module;
static ctrls_acttab_t ctrls_acttab[];
static const char *trace_channel = "ctrls";
/* Hard-coded Controls timer IDs. Need two, one for the initial timer, one
* to identify the user-configured-interval timer
*/
#define CTRLS_TIMER_ID 24075
static unsigned int ctrls_interval = 10;
/* Controls listening socket fd */
static int ctrls_sockfd = -1;
#define MOD_CTRLS_DEFAULT_SOCK PR_RUN_DIR "/proftpd.sock"
static char *ctrls_sock_file = MOD_CTRLS_DEFAULT_SOCK;
/* User/group ownership of the control socket */
static uid_t ctrls_sock_uid = 0;
static gid_t ctrls_sock_gid = 0;
/* Pool for this module's use */
static pool *ctrls_pool = NULL;
/* Required "freshness" of client credential sockets */
static unsigned int ctrls_cl_freshness = 10;
/* Start of the client list */
static pr_ctrls_cl_t *cl_list = NULL;
static unsigned int cl_listlen = 0;
static unsigned int cl_maxlistlen = 5;
/* Controls access control list. This is for ACLs on the control socket
* itself, rather than on individual actions.
*/
static ctrls_acl_t ctrls_sock_acl;
static unsigned char ctrls_engine = TRUE;
/* Necessary prototypes */
static int ctrls_setblock(int sockfd);
static int ctrls_setnonblock(int sockfd);
static const char *ctrls_logname = NULL;
/* Support routines
*/
/* Controls logging routines
*/
static int ctrls_closelog(void) {
if (ctrls_logname != NULL) {
pr_ctrls_set_logfd(-1);
ctrls_logname = NULL;
}
return 0;
}
static int ctrls_openlog(void) {
int logfd, res = 0, xerrno = 0;
/* Sanity check */
if (ctrls_logname == NULL) {
return 0;
}
PRIVS_ROOT
res = pr_log_openfile(ctrls_logname, &logfd, PR_LOG_SYSTEM_MODE);
xerrno = errno;
PRIVS_RELINQUISH
if (res == 0) {
pr_ctrls_set_logfd(logfd);
} else {
if (res == -1) {
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": unable to open ControlsLog '%s': %s", ctrls_logname,
strerror(xerrno));
} else if (res == PR_LOG_WRITABLE_DIR) {
pr_log_pri(PR_LOG_WARNING, MOD_CTRLS_VERSION
": unable to open ControlsLog '%s': "
"parent directory is world-writable", ctrls_logname);
} else if (res == PR_LOG_SYMLINK) {
pr_log_pri(PR_LOG_WARNING, MOD_CTRLS_VERSION
": unable to open ControlsLog '%s': %s is a symbolic link",
ctrls_logname, ctrls_logname);
}
}
return res;
}
/* Controls client routines
*/
static pr_ctrls_cl_t *ctrls_new_cl(void) {
pool *cl_pool = NULL;
if (cl_list == NULL) {
/* Our first client */
cl_pool = make_sub_pool(ctrls_pool);
pr_pool_tag(cl_pool, "Controls client pool");
cl_list = (pr_ctrls_cl_t *) pcalloc(cl_pool, sizeof(pr_ctrls_cl_t));
cl_list->cl_pool = cl_pool;
cl_list->cl_fd = -1;
cl_list->cl_uid = 0;
cl_list->cl_user = NULL;
cl_list->cl_gid = 0;
cl_list->cl_group = NULL;
cl_list->cl_pid = 0;
cl_list->cl_ctrls = make_array(cl_pool, 0, sizeof(pr_ctrls_t *));
cl_list->cl_next = NULL;
cl_list->cl_prev = NULL;
cl_listlen = 1;
} else {
pr_ctrls_cl_t *cl = NULL;
/* Add another victim to the list */
cl_pool = make_sub_pool(ctrls_pool);
pr_pool_tag(cl_pool, "Controls client pool");
cl = (pr_ctrls_cl_t *) pcalloc(cl_pool, sizeof(pr_ctrls_cl_t));
cl->cl_pool = cl_pool;
cl->cl_fd = -1;
cl->cl_uid = 0;
cl->cl_user = NULL;
cl->cl_gid = 0;
cl->cl_group = NULL;
cl->cl_pid = 0;
cl->cl_ctrls = make_array(cl->cl_pool, 0, sizeof(pr_ctrls_t *));
cl->cl_next = cl_list;
cl->cl_prev = NULL;
cl_list->cl_prev = cl;
cl_list = cl;
cl_listlen++;
}
return cl_list;
}
/* Add a new client to the set */
static pr_ctrls_cl_t *ctrls_add_cl(int cl_fd, uid_t cl_uid, gid_t cl_gid,
pid_t cl_pid, unsigned long cl_flags) {
pr_ctrls_cl_t *cl = NULL;
/* Make sure there's an empty entry available */
cl = ctrls_new_cl();
cl->cl_fd = cl_fd;
cl->cl_uid = cl_uid;
cl->cl_user = pr_auth_uid2name(cl->cl_pool, cl->cl_uid);
cl->cl_gid = cl_gid;
cl->cl_group = pr_auth_gid2name(cl->cl_pool, cl->cl_gid);
cl->cl_pid = cl_pid;
cl->cl_flags = cl_flags;
pr_ctrls_log(MOD_CTRLS_VERSION,
"accepted connection from %s/%s client", cl->cl_user, cl->cl_group);
return cl;
}
/* Remove a client from the set */
static void ctrls_del_cl(pr_ctrls_cl_t *cl) {
/* Remove this ctr_cl_t from the list, and free it */
if (cl->cl_next) {
cl->cl_next->cl_prev = cl->cl_prev;
}
if (cl->cl_prev) {
cl->cl_prev->cl_next = cl->cl_next;
} else {
cl_list = cl->cl_next;
}
(void) close(cl->cl_fd);
cl->cl_fd = -1;
destroy_pool(cl->cl_pool);
cl_listlen--;
}
/* Controls socket routines
*/
/* Iterate through any readable descriptors, reading each into appropriate
* client objects
*/
static void ctrls_cls_read(void) {
pr_ctrls_cl_t *cl;
cl = cl_list;
while (cl != NULL) {
pr_signals_handle();
if (pr_ctrls_recv_request(cl) < 0) {
if (errno == EOF) {
;
} else if (errno == EINVAL) {
/* Unsupported action requested */
if (cl->cl_flags == 0) {
cl->cl_flags = PR_CTRLS_CL_NOACTION;
}
pr_ctrls_log(MOD_CTRLS_VERSION,
"recvd from %s/%s client: (invalid action)", cl->cl_user,
cl->cl_group);
} else if (errno == EAGAIN ||
errno == EWOULDBLOCK) {
/* Malicious/blocked client */
if (cl->cl_flags == 0) {
cl->cl_flags = PR_CTRLS_CL_BLOCKED;
}
} else {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to receive client request: %s", strerror(errno));
}
} else {
pr_ctrls_t *ctrl;
char *request;
ctrl = *((pr_ctrls_t **) cl->cl_ctrls->elts);
request = (char *) ctrl->ctrls_action;
/* Request successfully read. Flag this client as being in such a
* state.
*/
if (cl->cl_flags == 0) {
cl->cl_flags = PR_CTRLS_CL_HAVEREQ;
}
if (ctrl->ctrls_cb_args != NULL) {
unsigned int reqargc;
char **reqargv;
/* Reconstruct the original request string from the client for
* logging.
*/
reqargc = ctrl->ctrls_cb_args->nelts;
reqargv = ctrl->ctrls_cb_args->elts;
while (reqargc--) {
request = pstrcat(cl->cl_pool, request, " ", *reqargv++, NULL);
}
pr_ctrls_log(MOD_CTRLS_VERSION,
"recvd from %s/%s client: '%s'", cl->cl_user, cl->cl_group,
request);
}
}
cl = cl->cl_next;
}
}
/* Iterate through any writable descriptors, writing out the responses to the
* appropriate client objects
*/
static int ctrls_cls_write(void) {
pr_ctrls_cl_t *cl;
cl = cl_list;
while (cl != NULL) {
pr_ctrls_cl_t *tmp_cl;
/* Necessary to keep track of the next client in the list while
* the list is being modified.
*/
tmp_cl = cl->cl_next;
pr_signals_handle();
/* This client has something to hear */
if (cl->cl_flags == PR_CTRLS_CL_NOACCESS) {
char *msg = "access denied";
/* ACL-denied access */
if (pr_ctrls_send_msg(cl->cl_fd, -1, 1, &msg) < 0) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to send response to %s/%s client: %s",
cl->cl_user, cl->cl_group, strerror(errno));
} else {
pr_ctrls_log(MOD_CTRLS_VERSION, "sent to %s/%s client: '%s'",
cl->cl_user, cl->cl_group, msg);
}
} else if (cl->cl_flags == PR_CTRLS_CL_NOACTION) {
char *msg = "unsupported action requested";
/* Unsupported action -- no matching controls */
if (pr_ctrls_send_msg(cl->cl_fd, -1, 1, &msg) < 0) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to send response to %s/%s client: %s",
cl->cl_user, cl->cl_group, strerror(errno));
} else {
pr_ctrls_log(MOD_CTRLS_VERSION, "sent to %s/%s client: '%s'",
cl->cl_user, cl->cl_group, msg);
}
} else if (cl->cl_flags == PR_CTRLS_CL_BLOCKED) {
char *msg = "blocked connection";
if (pr_ctrls_send_msg(cl->cl_fd, -1, 1, &msg) < 0) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to send response to %s/%s client: %s",
cl->cl_user, cl->cl_group, strerror(errno));
} else {
pr_ctrls_log(MOD_CTRLS_VERSION, "sent to %s/%s client: '%s'",
cl->cl_user, cl->cl_group, msg);
}
} else if (cl->cl_flags == PR_CTRLS_CL_HAVEREQ) {
if (cl->cl_ctrls != NULL &&
cl->cl_ctrls->nelts > 0) {
register unsigned int i = 0;
pr_ctrls_t **ctrlv = NULL;
ctrlv = (pr_ctrls_t **) cl->cl_ctrls->elts;
for (i = 0; i < cl->cl_ctrls->nelts; i++) {
if ((ctrlv[i])->ctrls_cb_retval < 1) {
/* Make sure the callback(s) added responses */
if ((ctrlv[i])->ctrls_cb_resps) {
if (pr_ctrls_send_msg(cl->cl_fd, (ctrlv[i])->ctrls_cb_retval,
(ctrlv[i])->ctrls_cb_resps->nelts,
(char **) (ctrlv[i])->ctrls_cb_resps->elts) < 0) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to send response to %s/%s "
"client: %s", cl->cl_user, cl->cl_group, strerror(errno));
} else {
/* For logging/accounting purposes */
register unsigned int j = 0;
int respval = (ctrlv[i])->ctrls_cb_retval;
unsigned int respargc = (ctrlv[i])->ctrls_cb_resps->nelts;
char **respargv = (ctrlv[i])->ctrls_cb_resps->elts;
pr_ctrls_log(MOD_CTRLS_VERSION,
"sent to %s/%s client: return value: %d",
cl->cl_user, cl->cl_group, respval);
for (j = 0; j < respargc; j++) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"sent to %s/%s client: '%s'", cl->cl_user, cl->cl_group,
respargv[j]);
}
}
} else {
/* No responses added by callbacks */
pr_ctrls_log(MOD_CTRLS_VERSION,
"notice: no responses given for %s/%s client: "
"check controls handlers", cl->cl_user, cl->cl_group);
}
}
}
}
}
pr_ctrls_log(MOD_CTRLS_VERSION,
"closed connection to %s/%s client", cl->cl_user, cl->cl_group);
/* Remove the client from the list */
ctrls_del_cl(cl);
cl = tmp_cl;
}
return 0;
}
/* Create a listening local socket */
static int ctrls_listen(const char *sock_file) {
int sockfd = -1, len = 0;
struct sockaddr_un sock;
#if !defined(SO_PEERCRED) && !defined(HAVE_GETPEEREID) && \
!defined(HAVE_GETPEERUCRED) && defined(LOCAL_CREDS)
int opt = 1;
socklen_t optlen = sizeof(opt);
#endif /* !LOCAL_CREDS */
/* No interruptions */
pr_signals_block();
/* Create the Unix domain socket */
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
int xerrno = errno;
pr_signals_unblock();
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": error: unable to create local socket: %s", strerror(xerrno));
errno = xerrno;
return -1;
}
/* Ensure that the socket used is not one of the major three fds (stdin,
* stdout, or stderr).
*/
if (sockfd <= STDERR_FILENO) {
int res;
res = pr_fs_get_usable_fd(sockfd);
if (res < 0) {
int xerrno = errno;
pr_signals_unblock();
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": error duplicating ctrls socket: %s", strerror(xerrno));
(void) close(sockfd);
errno = xerrno;
return -1;
}
(void) close(sockfd);
sockfd = res;
}
if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) < 0) {
int xerrno = errno;
pr_signals_unblock();
pr_log_pri(PR_LOG_WARNING,
"unable to set CLO_EXEC on ctrls socket fd %d: %s", sockfd,
strerror(xerrno));
(void) close(sockfd);
errno = xerrno;
return -1;
}
/* Make sure the path to which we want to bind this socket doesn't already
* exist.
*/
(void) unlink(sock_file);
/* Fill in the socket structure fields */
memset(&sock, 0, sizeof(sock));
sock.sun_family = AF_UNIX;
sstrncpy(sock.sun_path, sock_file, sizeof(sock.sun_path));
len = sizeof(sock);
/* Bind the name to the descriptor */
pr_trace_msg(trace_channel, 1, "binding ctrls socket fd %d to path '%s'",
sockfd, sock.sun_path);
if (bind(sockfd, (struct sockaddr *) &sock, len) < 0) {
int xerrno = errno;
pr_signals_unblock();
(void) close(sockfd);
errno = xerrno;
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": error: unable to bind to local socket: %s", strerror(xerrno));
pr_trace_msg(trace_channel, 1, "unable to bind to local socket: %s",
strerror(xerrno));
errno = xerrno;
return -1;
}
/* Start listening to the socket */
if (listen(sockfd, 5) < 0) {
int xerrno = errno;
pr_signals_unblock();
(void) close(sockfd);
errno = xerrno;
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": error: unable to listen on local socket '%s': %s", sock.sun_path,
strerror(xerrno));
pr_trace_msg(trace_channel, 1, "unable to listen on local socket '%s': %s",
sock.sun_path, strerror(xerrno));
errno = xerrno;
return -1;
}
#if !defined(SO_PEERCRED) && !defined(HAVE_GETPEEREID) && \
!defined(HAVE_GETPEERUCRED) && defined(LOCAL_CREDS)
/* Set the LOCAL_CREDS socket option. */
if (setsockopt(sockfd, 0, LOCAL_CREDS, &opt, optlen) < 0) {
pr_log_debug(DEBUG0, MOD_CTRLS_VERSION ": error enabling LOCAL_CREDS: %s",
strerror(errno));
}
#endif /* !LOCAL_CREDS */
/* Change the permissions on the socket, so that users can connect */
if (chmod(sock.sun_path, (mode_t) PR_CTRLS_MODE) < 0) {
int xerrno = errno;
pr_signals_unblock();
(void) close(sockfd);
errno = xerrno;
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": error: unable to chmod local socket: %s", strerror(xerrno));
pr_trace_msg(trace_channel, 1, "unable to chmod local socket: %s",
strerror(xerrno));
errno = xerrno;
return -1;
}
pr_signals_unblock();
return sockfd;
}
static int ctrls_recv_cl_reqs(void) {
fd_set cl_rset;
struct timeval timeout;
uid_t cl_uid;
gid_t cl_gid;
pid_t cl_pid;
unsigned long cl_flags = 0;
int cl_fd, max_fd;
timeout.tv_usec = 500L;
timeout.tv_sec = 0L;
/* look for any pending client connections */
while (cl_listlen < cl_maxlistlen) {
int res = 0, xerrno;
pr_signals_handle();
if (ctrls_sockfd < 0) {
break;
}
FD_ZERO(&cl_rset);
FD_SET(ctrls_sockfd, &cl_rset);
max_fd = ctrls_sockfd + 1;
res = select(max_fd + 1, &cl_rset, NULL, NULL, &timeout);
xerrno = errno;
if (res == 0) {
/* Go through the client list */
ctrls_cls_read();
return 0;
}
if (res < 0) {
if (xerrno == EINTR) {
pr_signals_handle();
continue;
}
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to select on local socket: %s", strerror(xerrno));
errno = xerrno;
return res;
}
if (FD_ISSET(ctrls_sockfd, &cl_rset)) {
/* Make sure the ctrl socket is non-blocking */
if (ctrls_setnonblock(ctrls_sockfd) < 0) {
xerrno = errno;
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to set nonblocking on local socket: %s",
strerror(xerrno));
errno = xerrno;
return -1;
}
/* Accept pending connections */
cl_fd = pr_ctrls_accept(ctrls_sockfd, &cl_uid, &cl_gid, &cl_pid,
ctrls_cl_freshness);
xerrno = errno;
if (cl_fd < 0) {
if (xerrno != ETIMEDOUT) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to accept connection: %s", strerror(xerrno));
}
continue;
}
/* Restore blocking mode to the ctrl socket */
if (ctrls_setblock(ctrls_sockfd) < 0) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to set blocking on local socket: %s",
strerror(errno));
}
/* Set this socket as non-blocking */
if (ctrls_setnonblock(cl_fd) < 0) {
pr_ctrls_log(MOD_CTRLS_VERSION,
"error: unable to set nonblocking on client socket: %s",
strerror(errno));
(void) close(cl_fd);
continue;
}
if (pr_ctrls_check_user_acl(cl_uid, &ctrls_sock_acl.acl_users) != TRUE &&
pr_ctrls_check_group_acl(cl_gid, &ctrls_sock_acl.acl_groups) != TRUE) {
cl_flags = PR_CTRLS_CL_NOACCESS;
}
/* Add the client to the list */
ctrls_add_cl(cl_fd, cl_uid, cl_gid, cl_pid, cl_flags);
}
}
/* Go through the client list */
ctrls_cls_read();
return 0;
}
static int ctrls_send_cl_resps(void) {
/* Go through the client list */
ctrls_cls_write();
return 0;
}
static int ctrls_setblock(int sockfd) {
int flags = 0;
int res = -1;
/* default error */
errno = EBADF;
flags = fcntl(sockfd, F_GETFL);
res = fcntl(sockfd, F_SETFL, flags & (U32BITS ^ O_NONBLOCK));
return res;
}
static int ctrls_setnonblock(int sockfd) {
int flags = 0;
int res = -1;
/* default error */
errno = EBADF;
flags = fcntl(sockfd, F_GETFL);
res = fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
return res;
}
static int ctrls_timer_cb(CALLBACK_FRAME) {
static unsigned char first_time = TRUE;
/* If the ControlsEngine is not to run, do nothing from here on out */
if (ctrls_engine == FALSE) {
(void) close(ctrls_sockfd);
ctrls_sockfd = -1;
if (is_master) {
/* Remove the local socket path as well */
(void) unlink(ctrls_sock_file);
}
return 0;
}
if (first_time == TRUE) {
/* Change the ownership on the socket to that configured by the admin */
PRIVS_ROOT
if (chown(ctrls_sock_file, ctrls_sock_uid, ctrls_sock_gid) < 0) {
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": unable to chown local socket %s: %s", ctrls_sock_file,
strerror(errno));
}
PRIVS_RELINQUISH
first_time = FALSE;
}
/* Please no alarms while doing this. */
pr_alarms_block();
/* Process pending requests. */
ctrls_recv_cl_reqs();
/* Run through the controls */
pr_run_ctrls(NULL, NULL);
/* Process pending responses */
ctrls_send_cl_resps();
/* Reset controls */
pr_ctrls_reset();
pr_alarms_unblock();
return 1;
}
/* Controls handlers
*/
static int respcmp(const void *a, const void *b) {
return strcmp(*((char **) a), *((char **) b));
}
static int ctrls_handle_help(pr_ctrls_t *ctrl, int reqargc,
char **reqargv) {
/* Run through the list of registered controls, and add them to the
* response, including the module in which they appear.
*/
if (reqargc != 0) {
pr_ctrls_add_response(ctrl, "wrong number of parameters");
return -1;
}
if (pr_get_registered_actions(ctrl, CTRLS_GET_DESC) < 0) {
pr_ctrls_add_response(ctrl, "unable to get actions: %s", strerror(errno));
} else {
/* Be nice, and sort the directives lexicographically */
qsort(ctrl->ctrls_cb_resps->elts, ctrl->ctrls_cb_resps->nelts,
sizeof(char *), respcmp);
}
return 0;
}
static int ctrls_handle_insctrl(pr_ctrls_t *ctrl, int reqargc,
char **reqargv) {
module *m = ANY_MODULE;
/* Enable a control into the registered controls list. This requires the
* action and, optionally, the module of the control to be enabled.
*/
/* Check the insctrl ACL */
if (pr_ctrls_check_acl(ctrl, ctrls_acttab, "insctrl") != TRUE) {
/* Access denied */
pr_ctrls_add_response(ctrl, "access denied");
return -1;
}
if (reqargc < 1 ||
reqargc > 2) {
pr_ctrls_add_response(ctrl, "wrong number of parameters");
return -1;
}
/* If the optional second parameter, a module name, is used, lookup
* the module pointer matching the name.
*/
if (reqargc == 2) {
m = pr_module_get(reqargv[1]);
}
if (pr_set_registered_actions(m, reqargv[0], FALSE, 0) < 0) {
if (errno == ENOENT) {
pr_ctrls_add_response(ctrl, "no such control: '%s'", reqargv[0]);
} else {
pr_ctrls_add_response(ctrl, "unable to enable '%s': %s", reqargv[0],
strerror(errno));
}
} else {
pr_ctrls_add_response(ctrl, "'%s' control enabled", reqargv[0]);
}
return 0;
}
static int ctrls_handle_lsctrl(pr_ctrls_t *ctrl, int reqargc,
char **reqargv) {
/* Run through the list of registered controls, and add them to the
* response, including the module in which they appear.
*/
/* Check the lsctrl ACL */
if (!pr_ctrls_check_acl(ctrl, ctrls_acttab, "lsctrl")) {
/* Access denied */
pr_ctrls_add_response(ctrl, "access denied");
return -1;
}
if (reqargc != 0) {
pr_ctrls_add_response(ctrl, "wrong number of parameters");
return -1;
}
if (pr_get_registered_actions(ctrl, CTRLS_GET_ACTION_ENABLED) < 0) {
pr_ctrls_add_response(ctrl, "unable to get actions: %s", strerror(errno));
} else {
/* Be nice, and sort the actions lexicographically */
qsort(ctrl->ctrls_cb_resps->elts, ctrl->ctrls_cb_resps->nelts,
sizeof(char *), respcmp);
}
return 0;
}
static int ctrls_handle_rmctrl(pr_ctrls_t *ctrl, int reqargc,
char **reqargv) {
module *m = ANY_MODULE;
/* Disable a control from the registered controls list. This requires the
* action and, optionally, the module of the control to be removed.
*/
/* Check the rmctrl ACL */
if (!pr_ctrls_check_acl(ctrl, ctrls_acttab, "rmctrl")) {
/* Access denied */
pr_ctrls_add_response(ctrl, "access denied");
return -1;
}
if (reqargc < 1 ||
reqargc > 2) {
pr_ctrls_add_response(ctrl, "wrong number of parameters");
return -1;
}
/* The three controls added by this module _cannot_ be removed (at least
* not via this control handler).
*/
if (strncmp(reqargv[0], "insctrl", 8) == 0 ||
strncmp(reqargv[0], "lsctrl", 7) == 0 ||
strncmp(reqargv[0], "rmctrl", 7) == 0) {
pr_ctrls_add_response(ctrl, "'%s' control cannot be removed", reqargv[0]);
return -1;
}
/* If the optional second parameter, a module name, is used, lookup
* the module pointer matching the name.
*/
if (reqargc == 2) {
m = pr_module_get(reqargv[1]);
}
if (pr_set_registered_actions(m, reqargv[0], FALSE,
PR_CTRLS_ACT_DISABLED) < 0) {
int xerrno = errno;
if (xerrno == ENOENT) {
pr_ctrls_add_response(ctrl, "no such control: '%s'", reqargv[0]);
} else {
pr_ctrls_add_response(ctrl, "unable to disable '%s': %s", reqargv[0],
strerror(xerrno));
}
} else {
if (strncmp(reqargv[0], "all", 4) != 0) {
pr_ctrls_add_response(ctrl, "'%s' control disabled", reqargv[0]);
} else {
/* If all actions have been disabled, stop listening on the local
* socket, and turn off this module's engine.
*/
pr_ctrls_add_response(ctrl, "all controls disabled");
pr_ctrls_add_response(ctrl, "restart the daemon to re-enable controls");
(void) close(ctrls_sockfd);
ctrls_sockfd = -1;
ctrls_engine = FALSE;
}
}
return 0;
}
/* Configuration handlers
*/
/* Default behavior is to deny everyone unless an ACL has been configured */
MODRET set_ctrlsacls(cmd_rec *cmd) {
int res;
char **actions = NULL;
const char *bad_action = NULL;
CHECK_ARGS(cmd, 4);
CHECK_CONF(cmd, CONF_ROOT);
/* Parse the given string of actions into a char **. Then iterate
* through the acttab, checking to see if a given control is _not_ in
* the list. If not in the list, unregister that control.
*/
/* We can cheat here, and use the ctrls_parse_acl() routine to
* separate the given string...
*/
actions = ctrls_parse_acl(cmd->tmp_pool, cmd->argv[1]);
/* Check the second parameter to make sure it is "allow" or "deny" */
if (strncmp(cmd->argv[2], "allow", 6) != 0 &&
strncmp(cmd->argv[2], "deny", 5) != 0) {
CONF_ERROR(cmd, "second parameter must be 'allow' or 'deny'");
}
/* Check the third parameter to make sure it is "user" or "group" */
if (strncmp(cmd->argv[3], "user", 5) != 0 &&
strncmp(cmd->argv[3], "group", 6) != 0) {
CONF_ERROR(cmd, "third parameter must be 'user' or 'group'");
}
res = pr_ctrls_set_module_acls2(ctrls_acttab, ctrls_pool, actions,
cmd->argv[2], cmd->argv[3], cmd->argv[4], &bad_action);
if (res < 0) {
CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, ": unknown action: '",
bad_action, "'", NULL));
}
return PR_HANDLED(cmd);
}
/* default: 10 secs */
MODRET set_ctrlsauthfreshness(cmd_rec *cmd) {
int freshness = 0;
CHECK_ARGS(cmd, 1);
CHECK_CONF(cmd, CONF_ROOT);
freshness = atoi(cmd->argv[1]);
if (freshness <= 0) {
CONF_ERROR(cmd, "must be a positive number");
}
ctrls_cl_freshness = freshness;
return PR_HANDLED(cmd);
}
MODRET set_ctrlsengine(cmd_rec *cmd) {
int bool = -1;
CHECK_ARGS(cmd, 1);
CHECK_CONF(cmd, CONF_ROOT);
bool = get_boolean(cmd, 1);
if (bool == -1) {
CONF_ERROR(cmd, "expected Boolean parameter");
}
ctrls_engine = bool;
return PR_HANDLED(cmd);
}
/* default: 10 secs */
MODRET set_ctrlsinterval(cmd_rec *cmd) {
int nsecs = 0;
CHECK_ARGS(cmd, 1);
CHECK_CONF(cmd, CONF_ROOT);
nsecs = atoi(cmd->argv[1]);
if (nsecs <= 0) {
CONF_ERROR(cmd, "must be a positive number");
}
/* Remove the existing timer, and re-install it with this new interval. */
ctrls_interval = nsecs;
pr_timer_remove(CTRLS_TIMER_ID, &ctrls_module);
pr_timer_add(ctrls_interval, CTRLS_TIMER_ID, &ctrls_module, ctrls_timer_cb,
"Controls polling");
return PR_HANDLED(cmd);
}
MODRET set_ctrlslog(cmd_rec *cmd) {
int res = 0;
CHECK_ARGS(cmd, 1);
CHECK_CONF(cmd, CONF_ROOT);
ctrls_logname = pstrdup(ctrls_pool, cmd->argv[1]);
res = ctrls_openlog();
if (res < 0) {
if (res == -1) {
CONF_ERROR(cmd, pstrcat(cmd->tmp_pool, "unable to open '",
(char *) cmd->argv[1], "': ", strerror(errno), NULL));
}
if (res == -2) {
CONF_ERROR(cmd, pstrcat(cmd->tmp_pool,
"unable to log to a world-writable directory", NULL));
}
}
return PR_HANDLED(cmd);
}
/* Default: 5 max clients */
MODRET set_ctrlsmaxclients(cmd_rec *cmd) {
int nclients = 0;
CHECK_ARGS(cmd, 1);
CHECK_CONF(cmd, CONF_ROOT);
nclients = atoi(cmd->argv[1]);
if (nclients <= 0) {
CONF_ERROR(cmd, "must be a positive number");
}
cl_maxlistlen = nclients;
return PR_HANDLED(cmd);
}
/* Default: var/run/proftpd.sock */
MODRET set_ctrlssocket(cmd_rec *cmd) {
char *path;
CHECK_ARGS(cmd, 1);
CHECK_CONF(cmd, CONF_ROOT);
path = cmd->argv[1];
if (*path != '/') {
CONF_ERROR(cmd, "must be an absolute path");
}
/* Close the socket. */
if (ctrls_sockfd >= 0) {
pr_trace_msg(trace_channel, 3, "closing ctrls socket '%s' (fd %d)",
ctrls_sock_file, ctrls_sockfd);
(void) unlink(ctrls_sock_file);
(void) close(ctrls_sockfd);
ctrls_sockfd = -1;
}
/* Change the path. */
if (strcmp(path, ctrls_sock_file) != 0) {
ctrls_sock_file = pstrdup(ctrls_pool, path);
}
return PR_HANDLED(cmd);
}
/* Default behavior is to deny everyone unless an ACL has been configured */
MODRET set_ctrlssocketacl(cmd_rec *cmd) {
CHECK_ARGS(cmd, 3);
CHECK_CONF(cmd, CONF_ROOT);
pr_ctrls_init_acl(&ctrls_sock_acl);
/* Check the first argument to make sure it either "allow" or "deny" */
if (strcasecmp(cmd->argv[1], "allow") != 0 &&
strcasecmp(cmd->argv[1], "deny") != 0) {
CONF_ERROR(cmd, "first parameter must be either 'allow' or 'deny'");
}
/* Check the second argument to see how to handle the directive */
if (strcasecmp(cmd->argv[2], "user") == 0) {
if (pr_ctrls_set_user_acl(ctrls_pool, &ctrls_sock_acl.acl_users,
cmd->argv[1], cmd->argv[3]) < 0) {
CONF_ERROR(cmd, pstrcat(cmd->tmp_pool,
"error configuring user socket ACL: ", strerror(errno), NULL));
}
} else if (strcasecmp(cmd->argv[2], "group") == 0) {
if (pr_ctrls_set_group_acl(ctrls_pool, &ctrls_sock_acl.acl_groups,
cmd->argv[1], cmd->argv[3]) < 0) {
CONF_ERROR(cmd, pstrcat(cmd->tmp_pool,
"error configuring group socket ACL: ", strerror(errno), NULL));
}
} else {
CONF_ERROR(cmd, "second parameter must be either 'user' or 'group'");
}
return PR_HANDLED(cmd);
}
/* Default: root root */
MODRET set_ctrlssocketowner(cmd_rec *cmd) {
gid_t gid = 0;
uid_t uid = 0;
CHECK_ARGS(cmd, 2);
CHECK_CONF(cmd, CONF_ROOT);
uid = pr_auth_name2uid(cmd->tmp_pool, cmd->argv[1]);
if (uid == (uid_t) -1) {
if (errno != EINVAL) {
pr_log_debug(DEBUG0, "%s: %s has UID of -1", (char *) cmd->argv[0],
(char *) cmd->argv[1]);
} else {
pr_log_debug(DEBUG0, "%s: no such user '%s'", (char *) cmd->argv[0],
(char *) cmd->argv[1]);
}
} else {
ctrls_sock_uid = uid;
}
gid = pr_auth_name2gid(cmd->tmp_pool, cmd->argv[2]);
if (gid == (gid_t) -1) {
if (errno != EINVAL) {
pr_log_debug(DEBUG0, "%s: %s has GID of -1", (char *) cmd->argv[0],
(char *) cmd->argv[2]);
} else {
pr_log_debug(DEBUG0, "%s: no such group '%s'", (char *) cmd->argv[0],
(char *) cmd->argv[2]);
}
} else {
ctrls_sock_gid = gid;
}
return PR_HANDLED(cmd);
}
/* Event handlers
*/
static void ctrls_shutdown_ev(const void *event_data, void *user_data) {
if (!is_master || !ctrls_engine)
return;
/* Close any connected clients */
if (cl_list != NULL) {
pr_ctrls_cl_t *cl = NULL;
for (cl = cl_list; cl; cl = cl->cl_next) {
if (cl->cl_fd >= 0) {
(void) close(cl->cl_fd);
cl->cl_fd = -1;
}
}
}
(void) close(ctrls_sockfd);
ctrls_sockfd = -1;
/* Remove the local socket path as well */
(void) unlink(ctrls_sock_file);
return;
}
static void ctrls_postparse_ev(const void *event_data, void *user_data) {
if (ctrls_engine == FALSE ||
ServerType == SERVER_INETD) {
return;
}
/* Start listening on the ctrl socket */
PRIVS_ROOT
ctrls_sockfd = ctrls_listen(ctrls_sock_file);
PRIVS_RELINQUISH
/* Start a timer for the checking/processing of the ctrl socket. */
pr_timer_remove(CTRLS_TIMER_ID, &ctrls_module);
pr_timer_add(ctrls_interval, CTRLS_TIMER_ID, &ctrls_module, ctrls_timer_cb,
"Controls polling");
}
static void ctrls_restart_ev(const void *event_data, void *user_data) {
register unsigned int i;
/* Block alarms while we're preparing for the restart. */
pr_alarms_block();
/* Close any connected clients */
if (cl_list != NULL) {
pr_ctrls_cl_t *cl = NULL;
for (cl = cl_list; cl; cl = cl->cl_next) {
if (cl->cl_fd >= 0) {
(void) close(cl->cl_fd);
cl->cl_fd = -1;
}
}
}
/* Reset the client list */
cl_list = NULL;
cl_listlen = 0;
pr_trace_msg(trace_channel, 3, "closing ctrls socket '%s' (fd %d)",
ctrls_sock_file, ctrls_sockfd);
(void) close(ctrls_sockfd);
ctrls_sockfd = -1;
ctrls_closelog();
/* Clear the existing pool */
if (ctrls_pool != NULL) {
destroy_pool(ctrls_pool);
ctrls_logname = NULL;
ctrls_sock_file = MOD_CTRLS_DEFAULT_SOCK;
}
/* Allocate the pool for this module's use */
ctrls_pool = make_sub_pool(permanent_pool);
pr_pool_tag(ctrls_pool, MOD_CTRLS_VERSION);
/* Register the control handlers */
for (i = 0; ctrls_acttab[i].act_action; i++) {
/* Allocate and initialize the ACL for this control. */
ctrls_acttab[i].act_acl = pcalloc(ctrls_pool, sizeof(ctrls_acl_t));
pr_ctrls_init_acl(ctrls_acttab[i].act_acl);
}
pr_timer_remove(CTRLS_TIMER_ID, &ctrls_module);
pr_alarms_unblock();
return;
}
/* Initialization routines
*/
static int ctrls_init(void) {
register unsigned int i = 0;
/* Allocate the pool for this module's use */
ctrls_pool = make_sub_pool(permanent_pool);
pr_pool_tag(ctrls_pool, MOD_CTRLS_VERSION);
/* Register the control handlers */
for (i = 0; ctrls_acttab[i].act_action; i++) {
/* Allocate and initialize the ACL for this control. */
ctrls_acttab[i].act_acl = pcalloc(ctrls_pool, sizeof(ctrls_acl_t));
pr_ctrls_init_acl(ctrls_acttab[i].act_acl);
if (pr_ctrls_register(&ctrls_module, ctrls_acttab[i].act_action,
ctrls_acttab[i].act_desc, ctrls_acttab[i].act_cb) < 0) {
pr_log_pri(PR_LOG_NOTICE, MOD_CTRLS_VERSION
": error registering '%s' control: %s",
ctrls_acttab[i].act_action, strerror(errno));
}
}
/* Make certain the socket ACL is initialized. */
memset(&ctrls_sock_acl, '\0', sizeof(ctrls_acl_t));
ctrls_sock_acl.acl_users.allow = ctrls_sock_acl.acl_groups.allow = FALSE;
pr_event_register(&ctrls_module, "core.restart", ctrls_restart_ev, NULL);
pr_event_register(&ctrls_module, "core.shutdown", ctrls_shutdown_ev, NULL);
pr_event_register(&ctrls_module, "core.postparse", ctrls_postparse_ev, NULL);
return 0;
}
static int ctrls_sess_init(void) {
/* Children are not to listen for or handle control requests */
ctrls_engine = FALSE;
pr_timer_remove(CTRLS_TIMER_ID, &ctrls_module);
pr_event_unregister(&ctrls_module, "core.restart", ctrls_restart_ev);
/* Close the inherited socket */
close(ctrls_sockfd);
ctrls_sockfd = -1;
return 0;
}
static ctrls_acttab_t ctrls_acttab[] = {
{ "help", "describe all registered controls", NULL,
ctrls_handle_help },
{ "insctrl", "enable a disabled control", NULL,
ctrls_handle_insctrl },
{ "lsctrl", "list all registered controls", NULL,
ctrls_handle_lsctrl },
{ "rmctrl", "disable a registered control", NULL,
ctrls_handle_rmctrl },
{ NULL, NULL, NULL, NULL }
};
/* Module API tables
*/
static conftable ctrls_conftab[] = {
{ "ControlsACLs", set_ctrlsacls, NULL },
{ "ControlsAuthFreshness", set_ctrlsauthfreshness, NULL },
{ "ControlsEngine", set_ctrlsengine, NULL },
{ "ControlsInterval", set_ctrlsinterval, NULL },
{ "ControlsLog", set_ctrlslog, NULL },
{ "ControlsMaxClients", set_ctrlsmaxclients, NULL },
{ "ControlsSocket", set_ctrlssocket, NULL },
{ "ControlsSocketACL", set_ctrlssocketacl, NULL },
{ "ControlsSocketOwner", set_ctrlssocketowner, NULL },
{ NULL }
};
module ctrls_module = {
NULL, NULL,
/* Module API version 2.0 */
0x20,
/* Module name */
"ctrls",
/* Module configuration handler table */
ctrls_conftab,
/* Module command handler table */
NULL,
/* Module authentication handler table */
NULL,
/* Module initialization function */
ctrls_init,
/* Session initialization function */
ctrls_sess_init,
/* Module version */
MOD_CTRLS_VERSION
};
|