Changeset 712
- Timestamp:
- 07/18/07 05:42:39
(1 year ago)
- Author:
- raphael
- Message:
Removed hardcoded /var/www/virtual path from 00_master.conf
Fixed #427: /etc/init.d/ispcp_daemon doesn't support "status"
Updated vhcs2ispcp.sql to reflect recent DB changes caused by #457
Added rotation of proftpd's log files (fixes incorrect ftp traffic counting when logs are big)
Cleaned up daemon code (also removed useless license-related stuff)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r711 |
r712 |
|
| 19 | 19 | - CONFIGS: |
|---|
| 20 | 20 | * Made changes to reflect fix for #465 |
|---|
| | 21 | * Removed hardcoded /var/www/virtual path from 00_master.conf |
|---|
| | 22 | * Fixed #427: /etc/init.d/ispcp_daemon doesn't support "status" |
|---|
| | 23 | * Updated vhcs2ispcp.sql to reflect recent DB changes caused by #457 |
|---|
| | 24 | * Added rotation of proftpd's log files (fixes incorrect ftp traffic counting when logs are big) |
|---|
| | 25 | - DAEMON: |
|---|
| | 26 | * Cleaned up code (also removed useless license-related stuff) |
|---|
| 21 | 27 | |
|---|
| 22 | 28 | 2007-07-16 Benedikt Heintel |
|---|
| 23 | 29 | - GUI: |
|---|
| 24 | | * Fixed #457: Improved max-attempts limit for lost password's CAPTCHA |
|---|
| | 30 | * Fixed #457: Improve max-attempts limit for lost password's CAPTCHA |
|---|
| 25 | 31 | * Fixed serveral errors. |
|---|
| 26 | 32 | - SQL: |
|---|
| r665 |
r712 |
|
| 19 | 19 | Alias /errors {ROOT_DIR}/gui/errordocs/ |
|---|
| 20 | 20 | |
|---|
| 21 | | ErrorDocument 401 /errors/index.php |
|---|
| 22 | | ErrorDocument 403 /errors/index.php |
|---|
| 23 | | ErrorDocument 404 /errors/index.php |
|---|
| 24 | | ErrorDocument 500 /errors/index.php |
|---|
| | 21 | ErrorDocument 401 /errors/401.html |
|---|
| | 22 | ErrorDocument 403 /errors/403.html |
|---|
| | 23 | ErrorDocument 404 /errors/404.html |
|---|
| | 24 | ErrorDocument 500 /errors/500.html |
|---|
| 25 | 25 | |
|---|
| 26 | 26 | Alias /pma {ROOT_DIR}/gui/tools/pma/ |
|---|
| … | … | |
| 53 | 53 | <IfModule mod_php4.c> |
|---|
| 54 | 54 | <Directory {ROOT_DIR}/gui> |
|---|
| 55 | | php_admin_value open_basedir "{ROOT_DIR}/gui/:/etc/ispcp/:/proc/:/var/www/virtual/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" |
|---|
| | 55 | php_admin_value open_basedir "{ROOT_DIR}/gui/:/etc/ispcp/:/proc/:{APACHE_WWW_DIR}/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" |
|---|
| 56 | 56 | php_admin_value session.save_path "{ROOT_DIR}/gui/phptmp/" |
|---|
| 57 | 57 | </Directory> |
|---|
| … | … | |
| 59 | 59 | <IfModule mod_php5.c> |
|---|
| 60 | 60 | <Directory {ROOT_DIR}/gui> |
|---|
| 61 | | php_admin_value open_basedir "{ROOT_DIR}/gui/:/etc/ispcp/:/proc/:/var/www/virtual/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" |
|---|
| | 61 | php_admin_value open_basedir "{ROOT_DIR}/gui/:/etc/ispcp/:/proc/:{APACHE_WWW_DIR}/:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" |
|---|
| 62 | 62 | php_admin_value session.save_path "{ROOT_DIR}/gui/phptmp/" |
|---|
| 63 | 63 | </Directory> |
|---|
| r652 |
r712 |
|
| 7 | 7 | # Modified for Debian GNU/Linux |
|---|
| 8 | 8 | # by Ian Murdock <imurdock@gnu.ai.mit.edu>. |
|---|
| 9 | | # Modified for Debian |
|---|
| | 9 | # Modified for Debian |
|---|
| 10 | 10 | # by Erik Lehmann <erik.lehmann@ispcp.net> |
|---|
| 11 | 11 | # |
|---|
| … | … | |
| 27 | 27 | case "$1" in |
|---|
| 28 | 28 | start) |
|---|
| 29 | | echo -n "Starting $DESC: " |
|---|
| 30 | 29 | start-stop-daemon --start --verbose --exec $DAEMON -- -p $PID |
|---|
| 31 | | echo "$NAME." |
|---|
| 32 | 30 | ;; |
|---|
| 33 | 31 | stop) |
|---|
| 34 | | echo -n "Stopping $DESC: " |
|---|
| 35 | | start-stop-daemon --stop --verbose --pidfile $PID --exec $DAEMON |
|---|
| 36 | | rm $PID |
|---|
| 37 | | echo "$NAME." |
|---|
| | 32 | start-stop-daemon --stop --verbose --pidfile $PID --exec $DAEMON --retry 5 |
|---|
| | 33 | rm $PID |
|---|
| 38 | 34 | ;; |
|---|
| 39 | 35 | restart|force-reload) |
|---|
| 40 | | echo "Restarting $DESC: " |
|---|
| 41 | | start-stop-daemon --stop --verbose --pidfile $PID --exec $DAEMON |
|---|
| | 36 | start-stop-daemon --stop --verbose --pidfile $PID --exec $DAEMON --retry 5 |
|---|
| 42 | 37 | rm $PID |
|---|
| 43 | 38 | start-stop-daemon --start --verbose --exec $DAEMON -- -p $PID |
|---|
| 44 | | echo "$NAME." |
|---|
| | 39 | ;; |
|---|
| | 40 | status) |
|---|
| | 41 | if [ -s $PID ]; then |
|---|
| | 42 | RPID=`cat $PID` |
|---|
| | 43 | kill -0 $RPID 2> /dev/null |
|---|
| | 44 | if [ "$?" = 0 ] ; then |
|---|
| | 45 | echo "$NAME is started" |
|---|
| | 46 | exit 0 |
|---|
| | 47 | fi |
|---|
| | 48 | fi |
|---|
| | 49 | echo "$NAME is stopped" |
|---|
| | 50 | exit 1 |
|---|
| 45 | 51 | ;; |
|---|
| 46 | 52 | *) |
|---|
| 47 | 53 | N=/etc/init.d/$NAME |
|---|
| 48 | | echo "Usage: $N {start|stop|restart|force-reload}" >&2 |
|---|
| | 54 | echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 |
|---|
| 49 | 55 | exit 1 |
|---|
| 50 | 56 | ;; |
|---|
| r683 |
r712 |
|
| 21 | 21 | endscript |
|---|
| 22 | 22 | } |
|---|
| | 23 | |
|---|
| | 24 | /var/log/proftpd/xferlog { |
|---|
| | 25 | daily |
|---|
| | 26 | rotate 7 |
|---|
| | 27 | missingok |
|---|
| | 28 | compress |
|---|
| | 29 | delaycompress |
|---|
| | 30 | postrotate |
|---|
| | 31 | /usr/bin/killall -HUP syslogd |
|---|
| | 32 | endscript |
|---|
| | 33 | } |
|---|
| | 34 | |
|---|
| | 35 | /var/log/proftpd/ftp_traff.log { |
|---|
| | 36 | daily |
|---|
| | 37 | rotate 7 |
|---|
| | 38 | missingok |
|---|
| | 39 | compress |
|---|
| | 40 | delaycompress |
|---|
| | 41 | prerotate |
|---|
| | 42 | /var/www/ispcp/engine/traffic/ispcp-vrl-traff &> /var/log/ispcp/ispcp-vrl-traff.log |
|---|
| | 43 | endscript |
|---|
| | 44 | postrotate |
|---|
| | 45 | /usr/bin/killall -HUP syslogd |
|---|
| | 46 | endscript |
|---|
| | 47 | } |
|---|
| r698 |
r712 |
|
| 2250 | 2250 | '{DEFAULT_ADMIN_ADDRESS}' => $main::cfg{'DEFAULT_ADMIN_ADDRESS'}, |
|---|
| 2251 | 2251 | '{ROOT_DIR}' => $main::cfg{'ROOT_DIR'}, |
|---|
| | 2252 | '{APACHE_WWW_DIR}' => $main::cfg{'APACHE_WWW_DIR'}, |
|---|
| 2252 | 2253 | '{APACHE_USERS_LOG_DIR}' => $main::cfg{'APACHE_USERS_LOG_DIR'}, |
|---|
| 2253 | 2254 | '{APACHE_LOG_DIR}' => $main::cfg{'APACHE_LOG_DIR'}, |
|---|
| … | … | |
| 2291 | 2292 | '{DEFAULT_ADMIN_ADDRESS}' => $main::cfg{'DEFAULT_ADMIN_ADDRESS'}, |
|---|
| 2292 | 2293 | '{ROOT_DIR}' => $main::cfg{'ROOT_DIR'}, |
|---|
| | 2294 | '{APACHE_WWW_DIR}' => $main::cfg{'APACHE_WWW_DIR'}, |
|---|
| 2293 | 2295 | '{APACHE_USERS_LOG_DIR}' => $main::cfg{'APACHE_USERS_LOG_DIR'}, |
|---|
| 2294 | 2296 | '{APACHE_LOG_DIR}' => $main::cfg{'APACHE_LOG_DIR'}, |
|---|
| … | … | |
| 2342 | 2344 | |
|---|
| 2343 | 2345 | # |
|---|
| 2344 | | # Disable default site --> 000-default (if not, ispcp is not working) |
|---|
| | 2346 | # Disable default site --> 000-default (if not, ispcp does not work) |
|---|
| 2345 | 2347 | # |
|---|
| 2346 | 2348 | |
|---|
| … | … | |
| 2353 | 2355 | # |
|---|
| 2354 | 2356 | # start fastcgi, suexec and rewrite mod |
|---|
| 2355 | | # Disable default site (if not, ispcp not working) |
|---|
| 2356 | 2357 | # |
|---|
| 2357 | 2358 | |
|---|
| … | … | |
| 2366 | 2367 | sys_command_rs("/usr/sbin/a2enmod proxy &> /tmp/ispcp-setup-services.log"); |
|---|
| 2367 | 2368 | } |
|---|
| | 2369 | |
|---|
| | 2370 | } |
|---|
| | 2371 | |
|---|
| | 2372 | # |
|---|
| | 2373 | # Disable default fastcgi, otherwise FastCgiIpcDir is already defined |
|---|
| | 2374 | # |
|---|
| | 2375 | |
|---|
| | 2376 | if (-e "/usr/sbin/a2dismod") { |
|---|
| | 2377 | |
|---|
| | 2378 | sys_command_rs("/usr/sbin/a2dismod fastcgi &> /tmp/ispcp-setup-services.log"); |
|---|
| 2368 | 2379 | |
|---|
| 2369 | 2380 | } |
|---|
| r689 |
r712 |
|
| 23 | 23 | ALTER TABLE `login` ADD `ipaddr` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL ; |
|---|
| 24 | 24 | ALTER TABLE `login` ADD `user_name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL ; |
|---|
| | 25 | ALTER TABLE `login` ADD `captcha_count` TINYINT( 1 ) NULL ; |
|---|
| 25 | 26 | ALTER TABLE `login` ADD `login_count` TINYINT( 1 ) NULL; |
|---|
| 26 | 27 | |
|---|
| r691 |
r712 |
|
| 53 | 53 | global $Version; |
|---|
| 54 | 54 | |
|---|
| | 55 | $code = 999; |
|---|
| | 56 | |
|---|
| 55 | 57 | @$socket = socket_create (AF_INET, SOCK_STREAM, 0); |
|---|
| 56 | 58 | if ($socket < 0) { |
|---|
| … | … | |
| 68 | 70 | $out = read_line($socket); |
|---|
| 69 | 71 | |
|---|
| | 72 | list($code) = explode(' ', $out); |
|---|
| | 73 | if ($code == 999) { |
|---|
| | 74 | return $out; |
|---|
| | 75 | } |
|---|
| | 76 | |
|---|
| 70 | 77 | /* send hello query */ |
|---|
| 71 | 78 | $query = "helo $Version\r\n"; |
|---|
| … | … | |
| 74 | 81 | /* read one line with helo answer */ |
|---|
| 75 | 82 | $out = read_line($socket); |
|---|
| | 83 | |
|---|
| | 84 | list($code) = explode(' ', $out); |
|---|
| | 85 | if ($code == 999) { |
|---|
| | 86 | return $out; |
|---|
| | 87 | } |
|---|
| 76 | 88 | |
|---|
| 77 | 89 | /* send reg check query */ |
|---|
| … | … | |
| 81 | 93 | $execute_replay = read_line($socket); |
|---|
| 82 | 94 | |
|---|
| | 95 | list($code) = explode(' ', $execute_replay); |
|---|
| | 96 | if ($code == 999) { |
|---|
| | 97 | return $out; |
|---|
| | 98 | } |
|---|
| | 99 | |
|---|
| 83 | 100 | /* send quit query */ |
|---|
| 84 | 101 | $quit_query = "bye\r\n"; |
|---|
| … | … | |
| 87 | 104 | $quit_replay = read_line($socket); |
|---|
| 88 | 105 | |
|---|
| 89 | | /* analyze key replay */ |
|---|
| 90 | | $answer = $execute_replay; |
|---|
| 91 | | |
|---|
| 92 | | /* close socket */ |
|---|
| | 106 | list($code) = explode(' ', $quit_replay); |
|---|
| | 107 | if ($code == 999) { |
|---|
| | 108 | return $out; |
|---|
| | 109 | } |
|---|
| | 110 | |
|---|
| | 111 | list($answer) = explode(' ', $execute_replay); |
|---|
| | 112 | |
|---|
| 93 | 113 | socket_close ($socket); |
|---|
| 94 | 114 | |
|---|
| 95 | | /* return function result */ |
|---|
| 96 | 115 | return $answer; |
|---|
| 97 | 116 | |
|---|
| r469 |
r712 |
|
| 21 | 21 | helo_cmd.o helo_syntax.o lr_cmd.o lr_syntax.o bye_cmd.o bye_syntax.o |
|---|
| 22 | 22 | |
|---|
| 23 | | BUILD = gcc -O2 -ansi -Wall -Wstrict-prototypes -pedantic -o |
|---|
| | 23 | BUILD = gcc -O3 -ansi -Wall -Wstrict-prototypes -pedantic -o |
|---|
| 24 | 24 | |
|---|
| 25 | | COMPILE = gcc -O2 -ansi -Wall -Wstrict-prototypes -pedantic -c -o |
|---|
| | 25 | COMPILE = gcc -O3 -ansi -Wall -Wstrict-prototypes -pedantic -c -o |
|---|
| 26 | 26 | |
|---|
| 27 | 27 | STRIP = strip -s |
|---|
| … | … | |
| 31 | 31 | $(STRIP) ispcp_daemon |
|---|
| 32 | 32 | |
|---|
| 33 | | ispcp_daemon.o: ispcp_daemon.c defs.h |
|---|
| 34 | | $(COMPILE) ispcp_daemon.o ispcp_daemon.c |
|---|
| 35 | | |
|---|
| 36 | | daemon_init.o: daemon_init.c daemon_init.h |
|---|
| 37 | | $(COMPILE) daemon_init.o daemon_init.c |
|---|
| 38 | | |
|---|
| 39 | | message.o: message.c message.h |
|---|
| 40 | | $(COMPILE) message.o message.c |
|---|
| 41 | | |
|---|
| 42 | | say.o: say.c say.h |
|---|
| 43 | | $(COMPILE) say.o say.c |
|---|
| 44 | | |
|---|
| 45 | | signal-handlers.o: signal-handlers.c signal-handlers.h |
|---|
| 46 | | $(COMPILE) signal-handlers.o signal-handlers.c |
|---|
| 47 | | |
|---|
| 48 | | receive_data.o: receive_data.c receive_data.h |
|---|
| 49 | | $(COMPILE) receive_data.o receive_data.c |
|---|
| 50 | | |
|---|
| 51 | | send_data.o: send_data.c send_data.h |
|---|
| 52 | | $(COMPILE) send_data.o send_data.c |
|---|
| 53 | | |
|---|
| 54 | | take_connection.o: take_connection.c take_connection.h |
|---|
| 55 | | $(COMPILE) take_connection.o take_connection.c |
|---|
| 56 | | |
|---|
| 57 | | send_line.o: send_line.c send_line.h |
|---|
| 58 | | $(COMPILE) send_line.o send_line.c |
|---|
| 59 | | |
|---|
| 60 | | recv_line.o: recv_line.c recv_line.h |
|---|
| 61 | | $(COMPILE) recv_line.o recv_line.c |
|---|
| 62 | | |
|---|
| 63 | | helo_cmd.o: helo_cmd.c helo_cmd.h |
|---|
| 64 | | $(COMPILE) helo_cmd.o helo_cmd.c |
|---|
| 65 | | |
|---|
| 66 | | helo_syntax.o: helo_syntax.c helo_syntax.h |
|---|
| 67 | | $(COMPILE) helo_syntax.o helo_syntax.c |
|---|
| 68 | | |
|---|
| 69 | | lr_cmd.o: lr_cmd.c lr_cmd.h |
|---|
| 70 | | $(COMPILE) lr_cmd.o lr_cmd.c |
|---|
| 71 | | |
|---|
| 72 | | lr_syntax.o: lr_syntax.c lr_syntax.h |
|---|
| 73 | | $(COMPILE) lr_syntax.o lr_syntax.c |
|---|
| 74 | | |
|---|
| 75 | | bye_cmd.o: bye_cmd.c bye_cmd.h |
|---|
| 76 | | $(COMPILE) bye_cmd.o bye_cmd.c |
|---|
| 77 | | |
|---|
| 78 | | bye_syntax.o: bye_syntax.c bye_syntax.h |
|---|
| 79 | | $(COMPILE) bye_syntax.o bye_syntax.c |
|---|
| | 33 | %.o: %.c |
|---|
| | 34 | $(COMPILE) $@ $*.c |
|---|
| 80 | 35 | |
|---|
| 81 | 36 | uninstall: clean |
|---|
| … | … | |
| 86 | 41 | rm -rf ispcp_daemon |
|---|
| 87 | 42 | |
|---|
| | 43 | .PHONY: clean uninstall |
|---|
| r480 |
r712 |
|
| 24 | 24 | # The ISPCP Home Page is at: |
|---|
| 25 | 25 | # |
|---|
| 26 | | # http://www.ispcp.net |
|---|
| | 26 | # http://www.isp-control.net |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | |
|---|
| … | … | |
| 31 | 31 | helo_cmd.o helo_syntax.o lr_cmd.o lr_syntax.o bye_cmd.o bye_syntax.o |
|---|
| 32 | 32 | |
|---|
| 33 | | BUILD = gcc -O2 -ansi -Wall -Wstrict-prototypes -pedantic -o |
|---|
| | 33 | BUILD = gcc -O3 -ansi -Wall -Wstrict-prototypes -pedantic -o |
|---|
| 34 | 34 | |
|---|
| 35 | | COMPILE = gcc -O2 -ansi -Wall -Wstrict-prototypes -pedantic -c -o |
|---|
| | 35 | COMPILE = gcc -O3 -ansi -Wall -Wstrict-prototypes -pedantic -c -o |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | STRIP = strip -s |
|---|
| … | … | |
| 41 | 41 | $(STRIP) ispcp_daemon |
|---|
| 42 | 42 | |
|---|
| 43 | | ispcp_daemon.o: ispcp_daemon.c defs.h |
|---|
| 44 | | $(COMPILE) ispcp_daemon.o ispcp_daemon.c |
|---|
| 45 | | |
|---|
| 46 | | daemon_init.o: daemon_init.c daemon_init.h |
|---|
| 47 | | $(COMPILE) daemon_init.o daemon_init.c |
|---|
| 48 | | |
|---|
| 49 | | message.o: message.c message.h |
|---|
| 50 | | $(COMPILE) message.o message.c |
|---|
| 51 | | |
|---|
| 52 | | say.o: say.c say.h |
|---|
| 53 | | $(COMPILE) say.o say.c |
|---|
| 54 | | |
|---|
| 55 | | signal-handlers.o: signal-handlers.c signal-handlers.h |
|---|
| 56 | | $(COMPILE) signal-handlers.o signal-handlers.c |
|---|
| 57 | | |
|---|
| 58 | | receive_data.o: receive_data.c receive_data.h |
|---|
| 59 | | $(COMPILE) receive_data.o receive_data.c |
|---|
| 60 | | |
|---|
| 61 | | send_data.o: send_data.c send_data.h |
|---|
| 62 | | $(COMPILE) send_data.o send_data.c |
|---|
| 63 | | |
|---|
| 64 | | take_connection.o: take_connection.c take_connection.h |
|---|
| 65 | | $(COMPILE) take_connection.o take_connection.c |
|---|
| 66 | | |
|---|
| 67 | | send_line.o: send_line.c send_line.h |
|---|
| 68 | | $(COMPILE) send_line.o send_line.c |
|---|
| 69 | | |
|---|
| 70 | | recv_line.o: recv_line.c recv_line.h |
|---|
| 71 | | $(COMPILE) recv_line.o recv_line.c |
|---|
| 72 | | |
|---|
| 73 | | helo_cmd.o: helo_cmd.c helo_cmd.h |
|---|
| 74 | | $(COMPILE) helo_cmd.o helo_cmd.c |
|---|
| 75 | | |
|---|
| 76 | | helo_syntax.o: helo_syntax.c helo_syntax.h |
|---|
| 77 | | $(COMPILE) helo_syntax.o helo_syntax.c |
|---|
| 78 | | |
|---|
| 79 | | lr_cmd.o: lr_cmd.c lr_cmd.h |
|---|
| 80 | | $(COMPILE) lr_cmd.o lr_cmd.c |
|---|
| 81 | | |
|---|
| 82 | | lr_syntax.o: lr_syntax.c lr_syntax.h |
|---|
| 83 | | $(COMPILE) lr_syntax.o lr_syntax.c |
|---|
| 84 | | |
|---|
| 85 | | bye_cmd.o: bye_cmd.c bye_cmd.h |
|---|
| 86 | | $(COMPILE) bye_cmd.o bye_cmd.c |
|---|
| 87 | | |
|---|
| 88 | | bye_syntax.o: bye_syntax.c bye_syntax.h |
|---|
| 89 | | $(COMPILE) bye_syntax.o bye_syntax.c |
|---|
| | 43 | %.o: %.c %.h |
|---|
| | 44 | $(COMPILE) $@ $*.c |
|---|
| 90 | 45 | |
|---|
| 91 | 46 | uninstall: clean |
|---|
| … | … | |
| 96 | 51 | rm -rf ispcp_daemon |
|---|
| 97 | 52 | |
|---|
| | 53 | .PHONY: clean uninstall |
|---|
| r154 |
r712 |
|
| 2 | 2 | #include "bye_cmd.h" |
|---|
| 3 | 3 | |
|---|
| 4 | | int bye_cmd(int fd) |
|---|
| | 4 | int bye_cmd(int fd, char *msg) |
|---|
| 5 | 5 | { |
|---|
| 6 | | char *buff = calloc(MAX_MSG_SIZE, sizeof(char)); |
|---|
| 7 | | |
|---|
| 8 | | int res; |
|---|
| 9 | | |
|---|
| 10 | | for ( ; ; ) { |
|---|
| 11 | | memset(buff, '\0', MAX_MSG_SIZE); |
|---|
| 12 | | |
|---|
| 13 | | if (recv_line(fd, buff, MAX_MSG_SIZE - 1) <= 0) { |
|---|
| 14 | | |
|---|
| 15 | | free(buff); |
|---|
| 16 | | |
|---|
| 17 | | return (-1); |
|---|
| 18 | | } |
|---|
| 19 | | |
|---|
| 20 | | res = bye_syntax(fd, buff); |
|---|
| 21 | | |
|---|
| 22 | | if (res == -1) { |
|---|
| 23 | | |
|---|
| 24 | | free(buff); |
|---|
| 25 | | |
|---|
| 26 | | return (-1); |
|---|
| 27 | | |
|---|
| 28 | | } else if (res == 1) |
|---|
| 29 | | continue; |
|---|
| 30 | | else |
|---|
| 31 | | break; |
|---|
| 32 | | } |
|---|
| 33 | | |
|---|
| 34 | | free(buff); |
|---|
| 35 | | |
|---|
| 36 | | return (NO_ERROR); |
|---|
| | 6 | return bye_syntax(fd, msg); |
|---|
| 37 | 7 | } |
|---|
| r154 |
r712 |
|
| 3 | 3 | #define _BYE_CMD_H |
|---|
| 4 | 4 | |
|---|
| 5 | | #define NO_ERROR 0 |
|---|
| 6 | | |
|---|
| 7 | | #define MAX_MSG_SIZE 1025 |
|---|
| | 5 | #include "defs.h" |
|---|
| 8 | 6 | |
|---|
| 9 | 7 | #include <sys/types.h> |
|---|
| … | … | |
| 17 | 15 | extern int bye_syntax(int fd, char *buff); |
|---|
| 18 | 16 | |
|---|
| 19 | | int bye_cmd(int fd); |
|---|
| | 17 | int bye_cmd(int fd, char *msg); |
|---|
| 20 | 18 | |
|---|
| 21 | | #else |
|---|
| 22 | | # |
|---|
| 23 | 19 | #endif |
|---|
| r154 |
r712 |
|
| 9 | 9 | |
|---|
| 10 | 10 | if (ptr != buff) { |
|---|
| 11 | | |
|---|
| 12 | | if (send_line(fd, message(MSG_BAD_SYNTAX), strlen(message(MSG_BAD_SYNTAX))) < 0) { |
|---|
| 13 | | return (-1); |
|---|
| 14 | | } |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | return (1); |
|---|
| r154 |
r712 |
|
| 3 | 3 | #define _BYE_SYNTAX_H |
|---|
| 4 | 4 | |
|---|
| | 5 | #include "defs.h" |
|---|
| | 6 | |
|---|
| 5 | 7 | #include <stdlib.h> |
|---|
| 6 | 8 | |
|---|
| 7 | 9 | #include <string.h> |
|---|
| 8 | | |
|---|
| 9 | | #define NO_ERROR 0 |
|---|
| 10 | | |
|---|
| 11 | | #define MAX_MSG_SIZE 1025 |
|---|
| 12 | | |
|---|
| 13 | | #define MSG_BAD_SYNTAX 10016 |
|---|
| 14 | | |
|---|
| 15 | | #define MSG_CMD_OK 10017 |
|---|
| 16 | | |
|---|
| 17 | | #define MSG_BYE_CMD 10019 |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | extern char *message(int message_number); |
|---|
| … | … | |
| 23 | 15 | int bye_syntax(int fd, char *buff); |
|---|
| 24 | 16 | |
|---|
| 25 | | #else |
|---|
| 26 | | # |
|---|
| 27 | 17 | #endif |
|---|
| r154 |
r712 |
|
| 26 | 26 | void daemon_init(const char *pname, int facility); |
|---|
| 27 | 27 | |
|---|
| 28 | | #else |
|---|
| 29 | | # |
|---|
| 30 | 28 | #endif |
|---|
| r469 |
r712 |
|
| 2 | 2 | |
|---|
| 3 | 3 | #define _DEFS_H |
|---|
| 4 | | |
|---|
| 5 | | /* Needed headers. */ |
|---|
| 6 | | |
|---|
| 7 | | /* |
|---|
| 8 | | calloc, malloc, free, realloc - Allocate and free dynamic memory |
|---|
| 9 | | */ |
|---|
| 10 | | |
|---|
| 11 | | #include <stdlib.h> |
|---|
| 12 | | |
|---|
| 13 | | /* |
|---|
| 14 | | Will we log it ? |
|---|
| 15 | | */ |
|---|
| 16 | | |
|---|
| 17 | | #include <syslog.h> |
|---|
| 18 | | |
|---|
| 19 | | /* |
|---|
| 20 | | Socket manipulation functions. |
|---|
| 21 | | */ |
|---|
| 22 | | |
|---|
| 23 | | #include <sys/stat.h> |
|---|
| 24 | | #include <sys/types.h> |
|---|
| 25 | | #include <sys/socket.h> |
|---|
| 26 | | |
|---|
| 27 | | /* |
|---|
| 28 | | Internet Socket Address Structure IPv4. |
|---|
| 29 | | */ |
|---|
| 30 | | |
|---|
| 31 | | #include <netinet/in.h> |
|---|
| 32 | | |
|---|
| 33 | | /* |
|---|
| 34 | | Socket timeouts. |
|---|
| 35 | | */ |
|---|
| 36 | | |
|---|
| 37 | | #include <sys/time.h> |
|---|
| 38 | | |
|---|
| 39 | | /* |
|---|
| 40 | | Signal handling. |
|---|
| 41 | | */ |
|---|
| 42 | | |
|---|
| 43 | | #include <signal.h> |
|---|
| 44 | | |
|---|
| 45 | | /* |
|---|
| 46 | | String manipulation. |
|---|
| 47 | | */ |
|---|
| 48 | | |
|---|
| 49 | | #include <string.h> |
|---|
| 50 | | |
|---|
| 51 | | /* |
|---|
| 52 | | Error handling. |
|---|
| 53 | | */ |
|---|
| 54 | | |
|---|
| 55 | | #include <errno.h> |
|---|
| 56 | | |
|---|
| 57 | | /* |
|---|
| 58 | | Something more about fork. |
|---|
| 59 | | */ |
|---|
| 60 | | |
|---|
| 61 | | #include <unistd.h> |
|---|
| 62 | | |
|---|
| 63 | | /* |
|---|
| 64 | | String manipulation. |
|---|
| 65 | | */ |
|---|
| 66 | | |
|---|
| 67 | | #include <stdio.h> |
|---|
| 68 | | |
|---|
| 69 | | /* |
|---|
| 70 | | inet_ntop() function. |
|---|
| 71 | | */ |
|---|
| 72 | | |
|---|
| 73 | | #include <arpa/inet.h> |
|---|
| 74 | | |
|---|
| 75 | | /* |
|---|
| 76 | | Predefined names. |
|---|
| 77 | | */ |
|---|
| 78 | 4 | |
|---|
| 79 | 5 | /* |
|---|
| … | … | |
| 96 | 22 | |
|---|
| 97 | 23 | /* |
|---|
| 98 | | Max length of transfferd messages. |
|---|
| | 24 | Max length of transferred messages. |
|---|
| 99 | 25 | */ |
|---|
| 100 | 26 | |
|---|
| … | … | |
| 105 | 31 | */ |
|---|
| 106 | 32 | |
|---|
| 107 | | #define MSG_MAX_COUNT 28 |
|---|
| | 33 | #define NO_ERROR 0 |
|---|
| 108 | 34 | |
|---|
| 109 | 35 | #define MSG_WELCOME 10001 |
|---|
| | 36 | #define MSG_WELCOME_TXT "250 OK ispCP Daemon v1.1 Welcomes You!\r\n" |
|---|
| | 37 | #define MSG_DAEMON_VER 10002 |
|---|
| | 38 | #define MSG_DAEMON_VER_TXT "ispCP daemon v1.1 started!" |
|---|
| | 39 | #define MSG_DAEMON_NAME 10003 |
|---|
| | 40 | #define MSG_DAEMON_NAME_TXT "ispcp_daemon" |
|---|
| | 41 | #define MSG_ERROR_LISTEN 10004 |
|---|
| | 42 | #define MSG_ERROR_LISTEN_TXT "listen() error: %s" |
|---|
| | 43 | #define MSG_SIG_CHLD 10005 |
|---|
| | 44 | #define MSG_SIG_CHLD_TXT "child %s terminated !" |
|---|
| | 45 | #define MSG_SIG_PIPE 10006 |
|---|
| | 46 | #define MSG_SIG_PIPE_TXT "Aeee! SIG_PIPE was received ! Will we survive ?" |
|---|
| | 47 | #define MSG_ERROR_EINTR 10007 |
|---|
| | 48 | #define MSG_ERROR_EINTR_TXT "EINTR was received ! continue;" |
|---|
| | 49 | #define MSG_ERROR_ACCEPT 10008 |
|---|
| | 50 | #define MSG_ERROR_ACCEPT_TXT "accept() error: %s" |
|---|
| | 51 | #define MSG_START_CHILD 10009 |
|---|
| | 52 | #define MSG_START_CHILD_TXT "child %s started !" |
|---|
| | 53 | #define MSG_ERROR_SOCKET_WR 10010 |
|---|
| | 54 | #define MSG_ERROR_SOCKET_WR_TXT "send_line(): socket write error: %s" |
|---|
| | 55 | #define MSG_BYTES_WRITTEN 10011 |
|---|
| | 56 | #define MSG_BYTES_WRITTEN_TXT "send_line(): %s byte(s) successfully written !" |
|---|
| | 57 | #define MSG_ERROR_SOCKET_RD 10012 |
|---|
| | 58 | #define MSG_ERROR_SOCKET_RD_TXT "read_line(): socket read error: %s" |
|---|
| | 59 | #define MSG_ERROR_SOCKET_EOF 10013 |
|---|
| | 60 | #define MSG_ERROR_SOCKET_EOF_TXT "read_line(): socket EOF ! other end closed the connection !" |
|---|
| | 61 | #define MSG_BYTES_READ 10014 |
|---|
| | 62 | #define MSG_BYTES_READ_TXT "read_line(): %s byte(s) successfully read !" |
|---|
| | 63 | #define MSG_HELO_CMD 10015 |
|---|
| | 64 | #define MSG_HELO_CMD_TXT "helo " |
|---|
| | 65 | #define MSG_BAD_SYNTAX 10016 |
|---|
| | 66 | #define MSG_BAD_SYNTAX_TXT "999 ERR Incorrect Syntax !\r\n" |
|---|
| | 67 | #define MSG_CMD_OK 10017 |
|---|
| | 68 | #define MSG_CMD_OK_TXT "250 OK " |
|---|
| | 69 | #define MSG_BYE_CMD 10018 |
|---|
| | 70 | #define MSG_BYE_CMD_TXT "bye" |
|---|
| | 71 | #define MSG_EQ_CMD 10019 |
|---|
| | 72 | #define MSG_EQ_CMD_TXT "execute query" |
|---|
| | 73 | #define MSG_CONF_FILE 10020 |
|---|
| | 74 | #define MSG_CONF_FILE_TXT "ispCP configuration file not found !" |
|---|
| | 75 | #define MSG_MISSING_REG_DATA 10021 |
|---|
| | 76 | #define MSG_MISSING_REG_DATA_TXT "ispCP data cannot be found in the config file !" |
|---|
| | 77 | #define MSG_ERROR_BIND 10022 |
|---|
| | 78 | #define MSG_ERROR_BIND_TXT "bind() error: %s ! \r\n Please check for an other running daemon!\r\n " |
|---|
| 110 | 79 | |
|---|
| 111 | | #define MSG_DAEMON_VER 10002 |
|---|
| | 80 | #define MSG_MAX_COUNT 22 |
|---|
| 112 | 81 | |
|---|
| 113 | | #define MSG_DAEMON_NAME 10003 |
|---|
| 114 | | |
|---|
| 115 | | #define MSG_ERROR_LISTEN 10004 |
|---|
| 116 | | |
|---|
| 117 | | #define MSG_SIG_CHLD 10005 |
|---|
| 118 | | |
|---|
| 119 | | #define MSG_SIG_PIPE 10006 |
|---|
| 120 | | |
|---|
| 121 | | #define MSG_ERROR_EINTR 10007 |
|---|
| 122 | | |
|---|
| 123 | | #define MSG_ERROR_ACCEPT 10008 |
|---|
| 124 | | |
|---|
| 125 | | #define MSG_START_CHILD 10009 |
|---|
| 126 | | |
|---|
| 127 | | #define MSG_ERROR_SOCKET_WR 10010 |
|---|
| 128 | | |
|---|
| 129 | | #define MSG_BYTES_WRITTEN 10011 |
|---|
| 130 | | |
|---|
| 131 | | #define MSG_ERROR_SOCKET_RD 10012 |
|---|
| 132 | | |
|---|
| 133 | | #define MSG_ERROR_SOCKET_EOF 10013 |
|---|
| 134 | | |
|---|
| 135 | | #define MSG_BYTES_READ 10014 |
|---|
| 136 | | |
|---|
| 137 | | #define MSG_HELO_CMD 10015 |
|---|
| 138 | | |
|---|
| 139 | | #define MSG_BAD_SYNTAX 10016 |
|---|
| 140 | | |
|---|
| 141 | | #define MSG_CMD_OK 10017 |
|---|
| 142 | | |
|---|
| 143 | | #define MSG_LR_CMD 10018 |
|---|
| 144 | | |
|---|
| 145 | | #define MSG_BYE_CMD 10019 |
|---|
| 146 | | |
|---|
| 147 | | #define MSG_LS_CMD 10018 |
|---|
| 148 | | |
|---|
| 149 | | #define MSG_EQ_CMD 10021 |
|---|
| 150 | | |
|---|
| 151 | | #define MSG_CONF_FILE 10022 |
|---|
| 152 | | |
|---|
| 153 | | #define MSG_MISSING_REG_DATA 10023 |
|---|
| 154 | | |
|---|
| 155 | | #define MSG_ERROR_SOCKET 10024 |
|---|
| 156 | | |
|---|
| 157 | | #define MSG_ERROR_CONNECT 10025 |
|---|
| 158 | | |
|---|
| 159 | | #define MSG_LSERVER_WELCOME 10026 |
|---|
| 160 | | |
|---|
| 161 | | #define MSG_LICENSE_ERROR 10027 |
|---|
| 162 | | |
|---|
| 163 | | #define MSG_ERROR_BIND 10028 |
|---|
| 164 | | |
|---|
| 165 | | /* |
|---|
| 166 | | Common Error Codes. |
|---|
| 167 | | */ |
|---|
| 168 | | #define NO_ERROR 0 |
|---|
| 169 | | |
|---|
| 170 | | |
|---|
| 171 | | /* Type definitions. */ |
|---|
| 172 | | |
|---|
| 173 | | typedef unsigned int word; |
|---|
| 174 | | |
|---|
| 175 | | |
|---|
| 176 | | /* Global variables. */ |
|---|
| 177 | | |
|---|
| 178 | | char *messages_array[MSG_MAX_COUNT][1] = { |
|---|
| 179 | | {"250 OK ispCP Server Welcomes You !\r\n"}, |
|---|
| 180 | | {"ispCP_daemon v1.0 started !"}, |
|---|
| 181 | | {"ispcp_daemon"}, |
|---|
| 182 | | {"listen() error: %s"}, |
|---|
| 183 | | {"child %s terminated !"}, |
|---|
| 184 | | {"Aeee! SIG_PIPE was received ! Will we survive ?"}, |
|---|
| 185 | | {"EINTR was received ! continue;"}, |
|---|
| 186 | | {"accept() error: %s"}, |
|---|
| 187 | | {"child %s started !"}, |
|---|
| 188 | | {"send_line(): socket write error: %s"}, |
|---|
| 189 | | {"send_line(): %s byte(s) successfully written !"}, |
|---|
| 190 | | {"read_line(): socket read error: %s"}, |
|---|
| 191 | | {"read_line(): socket EOF ! other end closed the connection !"}, |
|---|
| 192 | | {"read_line(): %s byte(s) successfully read !"}, |
|---|
| 193 | | {"helo "}, |
|---|
| 194 | | {"999 ERR Incorrect Syntax !\r\n"}, |
|---|
| 195 | | {"250 OK "}, |
|---|
| 196 | | {"license request: "}, |
|---|
| 197 | | {"bye"}, |
|---|
| 198 | | {"license status"}, |
|---|
| 199 | | {"execute query"}, |
|---|
| 200 | | {"ispCP configuration file not found !"}, |
|---|
| 201 | | {"ispCP data cannot be found in the config file !"}, |
|---|
| 202 | | {"Connect to license-server: socket() error [%s]!"}, |
|---|
| 203 | | {"Connect to license-server: connect() error [%s]!"}, |
|---|
| 204 | | {"250 OK ispCP Server Welcomes You !\r\n"}, |
|---|
| 205 | | {"999 ERR License error !\r\n"}, |
|---|
| 206 | | {"bind() error: %s ! \r\n Please check for another daemon runing !\r\n "} |
|---|
| 207 | | }; |
|---|
| 208 | | |
|---|
| 209 | | char client_ip [MAX_MSG_SIZE]; |
|---|
| 210 | | |
|---|
| 211 | | /* |
|---|
| 212 | | BEGIN: ispcp_daemon variables |
|---|
| 213 | | */ |
|---|
| 214 | | |
|---|
| 215 | | char product_number [MAX_MSG_SIZE]; |
|---|
| 216 | | |
|---|
| 217 | | char product_version [MAX_MSG_SIZE]; |
|---|
| 218 | | |
|---|
| 219 | | char license_key [MAX_MSG_SIZE]; |
|---|
| 220 | | |
|---|
| 221 | | char license_status [MAX_MSG_SIZE]; |
|---|
| 222 | | |
|---|
| 223 | | /* |
|---|
| 224 | | END: ispcp_daemon variables |
|---|
| 225 | | */ |
|---|
| 226 | | |
|---|
| 227 | | struct timeval *tv_rcv; |
|---|
| 228 | | |
|---|
| 229 | | struct timeval *tv_snd; |
|---|
| 230 | | |
|---|
| 231 | | /* External functions. */ |
|---|
| 232 | | |
|---|
| 233 | | extern void daemon_init(const char *pname, int facility); |
|---|
| 234 | | |
|---|
| 235 | | extern char *message(int message_number); |
|---|
| 236 | | |
|---|
| 237 | | extern void say(char *format, char *message); |
|---|
| 238 | | |
|---|
| 239 | | extern void sig_child (int signo); |
|---|
| 240 | | |
|---|
| 241 | | extern void sig_pipe(int signo); |
|---|
| 242 | | |
|---|
| 243 | | extern void take_connection(int sockfd); |
|---|
| 244 | | |
|---|
| 245 | | extern int query_license_server(void); |
|---|
| | 82 | extern char *messages_array[][1]; |
|---|
| 246 | 83 | |
|---|
| 247 | 84 | #endif |
|---|
| r154 |
r712 |
|
| 2 | 2 | #include "helo_cmd.h" |
|---|
| 3 | 3 | |
|---|
| 4 | | int helo_cmd(int fd, license_data_type *ld) |
|---|
| | 4 | int helo_cmd(int fd) |
|---|
| 5 | 5 | { |
|---|
| 6 | 6 | char *buff = calloc(MAX_MSG_SIZE, sizeof(char)); |
|---|
| 7 | 7 | int res; |
|---|
| 8 | 8 | |
|---|
| 9 | | for ( ; ; ) { |
|---|
| | 9 | while (1) { |
|---|
| 10 | 10 | memset(buff, '\0', MAX_MSG_SIZE); |
|---|
| 11 | 11 | |
|---|
| … | … | |
| 15 | 15 | } |
|---|
| 16 | 16 | |
|---|
| 17 | | res = helo_syntax(fd, ld, buff); |
|---|
| | 17 | res = helo_syntax(fd, buff); |
|---|
| 18 | 18 | |
|---|
| 19 | 19 | if (res == -1) { |
|---|
| r154 |
r712 |
|
| 3 | 3 | #define _HELO_CMD_H |
|---|
| 4 | 4 | |
|---|
| 5 | | #define NO_ERROR 0 |
|---|
| 6 | | |
|---|
| 7 | | #define MAX_MSG_SIZE 1025 |
|---|
| | 5 | #include "defs.h" |
|---|
| 8 | 6 | |
|---|
| 9 | 7 | #include <sys/types.h> |
|---|
| … | … | |
| 15 | 13 | #include <string.h> |
|---|
| 16 | 14 | |
|---|
| 17 | | typedef struct { |
|---|
| 18 | | |
|---|
| 19 | | char ip[MAX_MSG_SIZE]; |
|---|
| 20 | | |
|---|
| 21 | | char host[MAX_MSG_SIZE]; |
|---|
| 22 | | |
|---|
| 23 | | /* |
|---|
| 24 | | Request data. |
|---|
| 25 | | */ |
|---|
| 26 | | |
|---|
| 27 | | char rd[MAX_MSG_SIZE]; |
|---|
| 28 | | |
|---|
| 29 | | /* |
|---|
| 30 | | Status data. |
|---|
| 31 | | */ |
|---|
| 32 | | |
|---|
| 33 | | char sd[MAX_MSG_SIZE]; |
|---|
| 34 | | |
|---|
| 35 | | } license_data_type; |
|---|
| 36 | | |
|---|
| 37 | | /* |
|---|
| 38 | | extern char *message(int message_number); |
|---|
| 39 | | |
|---|
| 40 | | |
|---|
| 41 | | extern int send_line(int fd, char *src, size_t len); |
|---|
| 42 | | */ |
|---|
| 43 | | |
|---|
| 44 | 15 | extern void say(char *format, char *message); |
|---|
| 45 | 16 | |
|---|
| 46 | 17 | extern int recv_line(int fd, char *dest, size_t n); |
|---|
| 47 | 18 | |
|---|
| 48 | | extern int helo_syntax(int fd, license_data_type *ld, char *buff); |
|---|
| | 19 | extern int helo_syntax(int fd, char *buff); |
|---|
| 49 | 20 | |
|---|
| 50 | | int helo_cmd(int fd, license_data_type *ld); |
|---|
| | 21 | int helo_cmd(int fd); |
|---|
| 51 | 22 | |
|---|
| 52 | | #else |
|---|
| 53 | | # |
|---|
| 54 | 23 | #endif |
|---|
| r154 |
r712 |
|
| 2 | 2 | #include "helo_syntax.h" |
|---|
| 3 | 3 | |
|---|
| 4 | | int helo_syntax(int fd, license_data_type *ld, char *buff) |
|---|
| | 4 | int helo_syntax(int fd, char *buff) |
|---|
| 5 | 5 | { |
|---|
| 6 | 6 | char *ptr; |
|---|
| … | … | |
| 17 | 17 | |
|---|
| 18 | 18 | } else { |
|---|
| 19 | | char *helo_ans = calloc(MAX_MSG_SIZE, sizeof(char)); |
|---|
| 20 | | memset(ld -> ip, '\0', MAX_MSG_SIZE); |
|---|
| 21 | | |
|---|
| 22 | | memset(ld -> host, '\0', MAX_MSG_SIZE); |
|---|
| 23 | | |
|---|
| 24 | | strcat(ld -> ip, client_ip); |
|---|
| | 19 | char *helo_ans = calloc(MAX_MSG_SIZE, sizeof(char)); |
|---|
| 25 | 20 | |
|---|
| 26 | 21 | ptr = strstr(buff, " "); |
|---|
| 27 | 22 | |
|---|
| 28 | | strncat(ld -> host, ptr + 1, strlen(ptr + 1) - 2); |
|---|
| 29 | | |
|---|
| 30 | | strcat(helo_ans, message(MSG_CMD_OK)); |
|---|
| 31 | | strcat(helo_ans, ld -> host); |
|---|
| | 23 | strcat(helo_ans, message(MSG_CMD_OK)); |
|---|
| | 24 | strcat(helo_ans, client_ip); |
|---|
| | 25 | strcat(helo_ans, "/"); |
|---|
| | 26 | strncat(helo_ans, ptr + 1, strlen(ptr + 1) - 2); |
|---|
| 32 | 27 | strcat(helo_ans, "\r\n"); |
|---|
| 33 | 28 | |
|---|
| 34 | | |
|---|
| 35 | | if (send_line(fd, helo_ans, strlen(helo_ans)) < 0) { |
|---|
| 36 | | free(helo_ans); |
|---|
| | 29 | if (send_line(fd, helo_ans, strlen(helo_ans)) < 0) { |
|---|
| | 30 | free(helo_ans); |
|---|
| 37 | 31 | return (-1); |
|---|
| 38 | 32 | } |
|---|
| r154 |
r712 |
|
| 3 | 3 | #define _HELO_SYNTAX_H |
|---|
| 4 | 4 | |
|---|
| 5 | | #define NO_ERROR 0 |
|---|
| 6 | | |
|---|
| 7 | | #define MAX_MSG_SIZE 1025 |
|---|
| 8 | | |
|---|
| 9 | | #define MSG_HELO_CMD 10015 |
|---|
| 10 | | |
|---|
| 11 | | #define MSG_BAD_SYNTAX 10016 |
|---|
| 12 | | |
|---|
| 13 | | #define MSG_CMD_OK 10017 |
|---|
| | 5 | #include "defs.h" |
|---|
| 14 | 6 | |
|---|
| 15 | 7 | #include <sys/types.h> |
|---|
| … | … | |
| 21 | 13 | #include <stdio.h> |
|---|
| 22 | 14 | |
|---|
| 23 | | typedef struct { |
|---|
| 24 | | |
|---|
| 25 | | char ip[MAX_MSG_SIZE]; |
|---|
| 26 | | |
|---|
| 27 | | char host[MAX_MSG_SIZE]; |
|---|
| 28 | | |
|---|
| 29 | | /* |
|---|
| 30 | | Request data. |
|---|
| 31 | | */ |
|---|
| 32 | | |
|---|
| 33 | | char rd[MAX_MSG_SIZE]; |
|---|
| 34 | | |
|---|
| 35 | | /* |
|---|
| 36 | | Status data. |
|---|
| 37 | | */ |
|---|
| 38 | | |
|---|
| 39 | | char sd[MAX_MSG_SIZE]; |
|---|
| 40 | | |
|---|
| 41 | | } license_data_type; |
|---|
| 42 | | |
|---|
| 43 | 15 | extern char client_ip[MAX_MSG_SIZE]; |
|---|
| 44 | 16 | |
|---|
| … | … | |
| 49 | 21 | extern int send_line(int fd, char *src, size_t len); |
|---|
| 50 | 22 | |
|---|
| 51 | | int helo_syntax(int fd, license_data_type *ld, char *buff); |
|---|
| | 23 | int helo_syntax(int fd, char *buff); |
|---|
| 52 | 24 | |
|---|
| 53 | | #else |
|---|
| 54 | | # |
|---|
| 55 | 25 | #endif |
|---|
| r469 |
r712 |
|
| 1 | 1 | |
|---|
| 2 | | #include "defs.h" |
|---|
| | 2 | #include "ispcp_daemon.h" |
|---|
| 3 | 3 | |
|---|
| 4 | 4 | int getopt(int argc, char * const argv[], const char *optstring); |
|---|
|