Link Here
|
78 |
NULL |
78 |
NULL |
79 |
}; |
79 |
}; |
80 |
|
80 |
|
|
|
81 |
int log=0; |
81 |
|
82 |
|
82 |
/* flag to tell config parser to stop processing config file */ |
83 |
/* flag to tell config parser to stop processing config file */ |
83 |
static bool got_user_config = FALSE; |
84 |
static bool got_user_config = FALSE; |
Link Here
|
124 |
/* EXTERNALLY VISIBLE FUNCTIONS */ |
125 |
/* EXTERNALLY VISIBLE FUNCTIONS */ |
125 |
|
126 |
|
126 |
/* returns FALSE if there was an error, TRUE if not */ |
127 |
/* returns FALSE if there was an error, TRUE if not */ |
127 |
int read_shell_config( ShellOptions_t *opts, const char *filename ) |
128 |
int read_shell_config( ShellOptions_t *opts, const char *filename, int do_log ) |
128 |
{ |
129 |
{ |
129 |
FILE *cfg_file; /* config file ptr */ |
130 |
FILE *cfg_file; /* config file ptr */ |
130 |
int linenum; /* cfg file line counter */ |
131 |
int linenum; /* cfg file line counter */ |
131 |
int status = TRUE; /* were all the cfg lines good? */ |
132 |
int status = TRUE; /* were all the cfg lines good? */ |
132 |
char line[CFG_LINE_LEN + 1]; /* buffer to hold region */ |
133 |
char line[CFG_LINE_LEN + 1]; /* buffer to hold region */ |
133 |
|
134 |
|
|
|
135 |
log = do_log; |
134 |
memset(line, 0, CFG_LINE_LEN + 1); |
136 |
memset(line, 0, CFG_LINE_LEN + 1); |
135 |
cfg_file = fopen(filename, "r"); |
137 |
cfg_file = fopen(filename, "r"); |
136 |
if (!cfg_file) { |
138 |
if (!cfg_file && log ) { |
137 |
log_set_priority(LOG_WARNING); |
139 |
log_set_priority(LOG_WARNING); |
138 |
log_msg("config file (%s) missing, using defaults", filename); |
140 |
log_msg("config file (%s) missing, using defaults", filename); |
139 |
opts->shell_flags = RSSH_ALLOW_SCP; |
141 |
opts->shell_flags = RSSH_ALLOW_SCP; |
Link Here
|
169 |
*newline = '\0'; |
171 |
*newline = '\0'; |
170 |
else { |
172 |
else { |
171 |
/* there is no newline - log the error and find the EOL */ |
173 |
/* there is no newline - log the error and find the EOL */ |
172 |
log_set_priority(LOG_ERR); |
174 |
if (log){ |
173 |
log_msg("line %d: line too long", lineno); |
175 |
log_set_priority(LOG_ERR); |
|
|
176 |
log_msg("line %d: line too long", lineno); |
177 |
} |
174 |
while ( fgets(tmp, CFG_LINE_LEN, cfg_file) ){ |
178 |
while ( fgets(tmp, CFG_LINE_LEN, cfg_file) ){ |
175 |
if ( (newline = strchr(line, '\n')) ) |
179 |
if ( (newline = strchr(line, '\n')) ) |
176 |
break; |
180 |
break; |
Link Here
|
234 |
return TRUE; |
238 |
return TRUE; |
235 |
default: |
239 |
default: |
236 |
/* the keyword is unknown */ |
240 |
/* the keyword is unknown */ |
237 |
log_set_priority(LOG_ERR); |
241 |
if (log){ |
238 |
log_msg("line %d: syntax error parsing config file", lineno); |
242 |
log_set_priority(LOG_ERR); |
239 |
if ( keywrd[0] ) |
243 |
log_msg("line %d: syntax error parsing config file", |
|
|
244 |
lineno); |
245 |
} |
246 |
if ( keywrd[0] && log ) |
240 |
log_msg("unknown keyword: %s", keywrd); |
247 |
log_msg("unknown keyword: %s", keywrd); |
241 |
return FALSE; |
248 |
return FALSE; |
242 |
} |
249 |
} |
Link Here
|
320 |
/* initialize strings and pointers */ |
327 |
/* initialize strings and pointers */ |
321 |
memset(buf, 0, buflen); |
328 |
memset(buf, 0, buflen); |
322 |
if ( !(copy = strdup(str)) ){ |
329 |
if ( !(copy = strdup(str)) ){ |
323 |
log_set_priority(LOG_ERR); |
330 |
if (log){ |
324 |
log_msg("OOM error in get_token() (fatal)"); |
331 |
log_set_priority(LOG_ERR); |
|
|
332 |
log_msg("OOM error in get_token() (fatal)"); |
333 |
} |
325 |
exit(1); |
334 |
exit(1); |
326 |
} |
335 |
} |
327 |
start = copy; |
336 |
start = copy; |
Link Here
|
421 |
const int lineno ) |
430 |
const int lineno ) |
422 |
{ |
431 |
{ |
423 |
if ( !eat_comment(line) ){ |
432 |
if ( !eat_comment(line) ){ |
424 |
log_msg("line %d: syntax error parsing config file", lineno); |
433 |
if (log) log_msg("line %d: syntax error parsing config file", |
|
|
434 |
lineno); |
425 |
return FALSE; |
435 |
return FALSE; |
426 |
} |
436 |
} |
427 |
log_set_priority(LOG_INFO); |
437 |
if (log){ |
428 |
log_msg("allowing scp to all users"); |
438 |
log_set_priority(LOG_INFO); |
|
|
439 |
log_msg("allowing scp to all users"); |
440 |
} |
429 |
opts->shell_flags |= RSSH_ALLOW_SCP; |
441 |
opts->shell_flags |= RSSH_ALLOW_SCP; |
430 |
return TRUE; |
442 |
return TRUE; |
431 |
} |
443 |
} |
Link Here
|
445 |
int pos; |
457 |
int pos; |
446 |
|
458 |
|
447 |
if ( !(pos = eat_comment(line)) ){ |
459 |
if ( !(pos = eat_comment(line)) ){ |
448 |
log_msg("line %d: syntax error parsing config file", lineno); |
460 |
if (log) log_msg("line %d: syntax error parsing config file", |
|
|
461 |
lineno); |
449 |
return FALSE; |
462 |
return FALSE; |
450 |
} |
463 |
} |
451 |
log_set_priority(LOG_INFO); |
464 |
if (log){ |
452 |
log_msg("allowing sftp to all users"); |
465 |
log_set_priority(LOG_INFO); |
|
|
466 |
log_msg("allowing sftp to all users"); |
467 |
} |
453 |
opts->shell_flags |= RSSH_ALLOW_SFTP; |
468 |
opts->shell_flags |= RSSH_ALLOW_SFTP; |
454 |
return TRUE; |
469 |
return TRUE; |
455 |
} |
470 |
} |
Link Here
|
470 |
int pos; |
485 |
int pos; |
471 |
|
486 |
|
472 |
if ( !(pos = eat_comment(line)) ){ |
487 |
if ( !(pos = eat_comment(line)) ){ |
473 |
log_msg("line %d: syntax error parsing config file", lineno); |
488 |
if (log) log_msg("line %d: syntax error parsing config file", |
|
|
489 |
lineno); |
474 |
return FALSE; |
490 |
return FALSE; |
475 |
} |
491 |
} |
476 |
log_set_priority(LOG_INFO); |
492 |
if (log){ |
477 |
log_msg("allowing cvs to all users"); |
493 |
log_set_priority(LOG_INFO); |
|
|
494 |
log_msg("allowing cvs to all users"); |
495 |
} |
478 |
opts->shell_flags |= RSSH_ALLOW_CVS; |
496 |
opts->shell_flags |= RSSH_ALLOW_CVS; |
479 |
return TRUE; |
497 |
return TRUE; |
480 |
} |
498 |
} |
Link Here
|
495 |
int pos; |
513 |
int pos; |
496 |
|
514 |
|
497 |
if ( !(pos = eat_comment(line)) ){ |
515 |
if ( !(pos = eat_comment(line)) ){ |
498 |
log_msg("line %d: syntax error parsing config file", lineno); |
516 |
if (log) log_msg("line %d: syntax error parsing config file", |
|
|
517 |
lineno); |
499 |
return FALSE; |
518 |
return FALSE; |
500 |
} |
519 |
} |
501 |
log_set_priority(LOG_INFO); |
520 |
log_set_priority(LOG_INFO); |
502 |
log_msg("allowing rdist to all users"); |
521 |
if (log){ |
503 |
opts->shell_flags |= RSSH_ALLOW_RDIST; |
522 |
log_msg("allowing rdist to all users"); |
|
|
523 |
opts->shell_flags |= RSSH_ALLOW_RDIST; |
524 |
} |
504 |
return TRUE; |
525 |
return TRUE; |
505 |
} |
526 |
} |
506 |
|
527 |
|
Link Here
|
520 |
int pos; |
541 |
int pos; |
521 |
|
542 |
|
522 |
if ( !(pos = eat_comment(line)) ){ |
543 |
if ( !(pos = eat_comment(line)) ){ |
523 |
log_msg("line %d: syntax error parsing config file", lineno); |
544 |
if (log) log_msg("line %d: syntax error parsing config file", |
|
|
545 |
lineno); |
524 |
return FALSE; |
546 |
return FALSE; |
525 |
} |
547 |
} |
526 |
log_set_priority(LOG_INFO); |
548 |
if (log){ |
527 |
log_msg("allowing rsync to all users"); |
549 |
log_set_priority(LOG_INFO); |
|
|
550 |
log_msg("allowing rsync to all users"); |
551 |
} |
528 |
opts->shell_flags |= RSSH_ALLOW_RSYNC; |
552 |
opts->shell_flags |= RSSH_ALLOW_RSYNC; |
529 |
return TRUE; |
553 |
return TRUE; |
530 |
} |
554 |
} |
Link Here
|
546 |
*/ |
570 |
*/ |
547 |
|
571 |
|
548 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
572 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
549 |
log_msg("fatal error: can't allocate space for chroot path"); |
573 |
if (log) log_msg("fatal error: can't allocate space for chroot path"); |
550 |
exit(1); |
574 |
exit(1); |
551 |
} |
575 |
} |
552 |
/* get_asgn_param() eats trailing comments, so we won't */ |
576 |
/* get_asgn_param() eats trailing comments, so we won't */ |
Link Here
|
557 |
|
581 |
|
558 |
/* get rid of any old value for chroot path, assign new one */ |
582 |
/* get rid of any old value for chroot path, assign new one */ |
559 |
if ( opts->chroot_path ) free(opts->chroot_path); |
583 |
if ( opts->chroot_path ) free(opts->chroot_path); |
560 |
log_set_priority(LOG_INFO); |
584 |
if (log){ |
561 |
log_msg("chrooting all users to %s", temp); |
585 |
log_set_priority(LOG_INFO); |
|
|
586 |
log_msg("chrooting all users to %s", temp); |
587 |
} |
562 |
/* we must not free temp, since opts points to it */ |
588 |
/* we must not free temp, since opts points to it */ |
563 |
opts->chroot_path = temp; |
589 |
opts->chroot_path = temp; |
564 |
opts->shell_flags |= RSSH_USE_CHROOT; |
590 |
opts->shell_flags |= RSSH_USE_CHROOT; |
Link Here
|
576 |
int pos; |
602 |
int pos; |
577 |
|
603 |
|
578 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
604 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
579 |
log_set_priority(LOG_ERR); |
605 |
if (log){ |
580 |
log_msg("fatal error: can't allocate space for log facility"); |
606 |
log_set_priority(LOG_ERR); |
|
|
607 |
log_msg("fatal error: can't allocate space for log facility"); |
608 |
} |
581 |
exit(1); |
609 |
exit(1); |
582 |
} |
610 |
} |
583 |
/* this eats trailing comments */ |
611 |
/* this eats trailing comments */ |
Link Here
|
747 |
|
775 |
|
748 |
free(temp); |
776 |
free(temp); |
749 |
if ( !eat_comment(line + pos) ){ |
777 |
if ( !eat_comment(line + pos) ){ |
750 |
log_msg("line %d: syntax error parsing config file", lineno); |
778 |
if (log) log_msg("line %d: syntax error parsing config file", |
|
|
779 |
lineno); |
751 |
return FALSE; |
780 |
return FALSE; |
752 |
} |
781 |
} |
753 |
if ( facname ){ |
782 |
if ( facname ){ |
754 |
log_set_priority(LOG_INFO); |
783 |
log_set_priority(LOG_INFO); |
755 |
log_msg("setting log facility to %s", facname); |
784 |
if (log) log_msg("setting log facility to %s", facname); |
756 |
log_set_facility(fac); |
785 |
log_set_facility(fac); |
757 |
return TRUE; |
786 |
return TRUE; |
758 |
} |
787 |
} |
759 |
log_msg("line %d: unknown log facility specified", lineno); |
788 |
if (log){ |
760 |
log_set_facility(LOG_USER); |
789 |
log_msg("line %d: unknown log facility specified", lineno); |
|
|
790 |
log_set_facility(LOG_USER); |
791 |
} |
761 |
return FALSE; |
792 |
return FALSE; |
762 |
} |
793 |
} |
763 |
|
794 |
|
Link Here
|
770 |
int mask; /* umask */ |
801 |
int mask; /* umask */ |
771 |
|
802 |
|
772 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
803 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
773 |
log_set_priority(LOG_ERR); |
804 |
if (log){ |
774 |
log_msg("fatal error: can't allocate space in process_umask()"); |
805 |
log_set_priority(LOG_ERR); |
|
|
806 |
log_msg("fatal error: can't allocate space in process_umask()"); |
807 |
} |
775 |
exit(1); |
808 |
exit(1); |
776 |
} |
809 |
} |
777 |
/* this eats trailing comments */ |
810 |
/* this eats trailing comments */ |
Link Here
|
782 |
|
815 |
|
783 |
/* convert the umask to a number */ |
816 |
/* convert the umask to a number */ |
784 |
if ( !validate_umask(temp, &mask) ){ |
817 |
if ( !validate_umask(temp, &mask) ){ |
785 |
log_set_priority(LOG_WARNING); |
818 |
if (log){ |
786 |
log_msg("line %d: invalid umask specified, using default 077", |
819 |
log_set_priority(LOG_WARNING); |
|
|
820 |
log_msg("line %d: invalid umask specified, using default 077", |
787 |
lineno); |
821 |
lineno); |
|
|
822 |
} |
788 |
opts->rssh_umask = 077; |
823 |
opts->rssh_umask = 077; |
789 |
free(temp); |
824 |
free(temp); |
790 |
return FALSE; |
825 |
return FALSE; |
791 |
} |
826 |
} |
792 |
log_set_priority(LOG_INFO); |
827 |
if (log){ |
793 |
log_msg("setting umask to %#o", mask); |
828 |
log_set_priority(LOG_INFO); |
|
|
829 |
log_msg("setting umask to %#o", mask); |
830 |
} |
794 |
opts->rssh_umask = mask; |
831 |
opts->rssh_umask = mask; |
795 |
free(temp); |
832 |
free(temp); |
796 |
return TRUE; |
833 |
return TRUE; |
Link Here
|
817 |
|
854 |
|
818 |
/* make space for user options */ |
855 |
/* make space for user options */ |
819 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
856 |
if ( !(temp = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
820 |
log_msg("fatal error: can't allocate space for user options"); |
857 |
if (log) log_msg("fatal error: can't allocate space for user options"); |
821 |
exit(1); |
858 |
exit(1); |
822 |
} |
859 |
} |
823 |
|
860 |
|
Link Here
|
831 |
|
868 |
|
832 |
/* now process individual config bits of temp */ |
869 |
/* now process individual config bits of temp */ |
833 |
if ( !(pos = get_token(temp, user, CFG_LINE_LEN + 1, TRUE, TRUE )) ){ |
870 |
if ( !(pos = get_token(temp, user, CFG_LINE_LEN + 1, TRUE, TRUE )) ){ |
834 |
log_set_priority(LOG_ERR); |
871 |
if (log){ |
835 |
log_msg("syntax error parsing config file, line %d", lineno); |
872 |
log_set_priority(LOG_ERR); |
|
|
873 |
log_msg("syntax error parsing config file, line %d", |
874 |
lineno); |
875 |
} |
836 |
return FALSE; |
876 |
return FALSE; |
837 |
} |
877 |
} |
838 |
|
878 |
|
Link Here
|
845 |
* user lines we don't care about... |
885 |
* user lines we don't care about... |
846 |
*/ |
886 |
*/ |
847 |
if ( (strcmp(user, username)) ) return TRUE; |
887 |
if ( (strcmp(user, username)) ) return TRUE; |
848 |
log_set_priority(LOG_INFO); |
888 |
if (log){ |
849 |
log_msg("line %d: configuring user %s", lineno, user); |
889 |
log_set_priority(LOG_INFO); |
|
|
890 |
log_msg("line %d: configuring user %s", lineno, user); |
891 |
} |
850 |
if ( !(len = eat_colon(temp + pos)) ){ |
892 |
if ( !(len = eat_colon(temp + pos)) ){ |
851 |
log_msg("syntax error parsing config file: line %d ", lineno); |
893 |
if (log) log_msg("syntax error parsing config file: line %d ", |
|
|
894 |
lineno); |
852 |
return FALSE; |
895 |
return FALSE; |
853 |
} |
896 |
} |
854 |
pos += len; |
897 |
pos += len; |
Link Here
|
856 |
/* do the umask, but validate it last, since it's non-fatal */ |
899 |
/* do the umask, but validate it last, since it's non-fatal */ |
857 |
if ( !(len = get_token(temp + pos, mask, CFG_LINE_LEN + 1, |
900 |
if ( !(len = get_token(temp + pos, mask, CFG_LINE_LEN + 1, |
858 |
TRUE, FALSE)) ){ |
901 |
TRUE, FALSE)) ){ |
859 |
log_set_priority(LOG_ERR); |
902 |
if (log){ |
860 |
log_msg("syntax error parsing user umask, line %d", lineno); |
903 |
log_set_priority(LOG_ERR); |
|
|
904 |
log_msg("syntax error parsing user umask, line %d", lineno); |
905 |
} |
861 |
return FALSE; |
906 |
return FALSE; |
862 |
} |
907 |
} |
863 |
pos += len; |
908 |
pos += len; |
864 |
|
909 |
|
865 |
/* do the access bits */ |
910 |
/* do the access bits */ |
866 |
if ( !(len = eat_colon(temp + pos)) ){ |
911 |
if ( !(len = eat_colon(temp + pos)) ){ |
867 |
log_msg("syntax error parsing config file: line %d ", lineno); |
912 |
if (log) log_msg("syntax error parsing config file: line %d ", |
|
|
913 |
lineno); |
868 |
return FALSE; |
914 |
return FALSE; |
869 |
} |
915 |
} |
870 |
pos += len; |
916 |
pos += len; |
871 |
if ( !(len = get_token(temp + pos, axs, CFG_LINE_LEN + 1, |
917 |
if ( !(len = get_token(temp + pos, axs, CFG_LINE_LEN + 1, |
872 |
TRUE, FALSE)) ){ |
918 |
TRUE, FALSE)) ){ |
873 |
log_set_priority(LOG_ERR); |
919 |
if (log){ |
874 |
log_msg("syntax error parsing user access, line %d", lineno); |
920 |
log_set_priority(LOG_ERR); |
|
|
921 |
log_msg("syntax error parsing user access, line %d", lineno); |
922 |
} |
875 |
return FALSE; |
923 |
return FALSE; |
876 |
} |
924 |
} |
877 |
if ( !validate_access(axs, &allow_sftp, &allow_scp, &allow_cvs, |
925 |
if ( !validate_access(axs, &allow_sftp, &allow_scp, &allow_cvs, |
878 |
&allow_rdist, &allow_rsync) ){ |
926 |
&allow_rdist, &allow_rsync) ){ |
879 |
log_set_priority(LOG_ERR); |
927 |
if (log){ |
880 |
log_msg("syntax error parsing access bits, line %d", lineno); |
928 |
log_set_priority(LOG_ERR); |
|
|
929 |
log_msg("syntax error parsing access bits, line %d", lineno); |
930 |
} |
881 |
return FALSE; |
931 |
return FALSE; |
882 |
} |
932 |
} |
883 |
pos += len; |
933 |
pos += len; |
Link Here
|
886 |
if ( !(len = eat_colon(temp + pos)) ) goto cleanup; |
936 |
if ( !(len = eat_colon(temp + pos)) ) goto cleanup; |
887 |
pos += len; |
937 |
pos += len; |
888 |
if ( !(path = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
938 |
if ( !(path = (char *)malloc(CFG_LINE_LEN + 1)) ){ |
889 |
log_msg("fatal error: can't allocate space for chroot path"); |
939 |
if (log) log_msg("fatal error: can't allocate space for chroot path"); |
890 |
exit(1); |
940 |
exit(1); |
891 |
} |
941 |
} |
892 |
if ( !(len = get_token(temp + pos, path, CFG_LINE_LEN + 1, |
942 |
if ( !(len = get_token(temp + pos, path, CFG_LINE_LEN + 1, |
Link Here
|
900 |
/* make sure nothing is left */ |
950 |
/* make sure nothing is left */ |
901 |
while ( *(temp + pos) != '\0' && isspace(*(temp + pos)) ) pos++; |
951 |
while ( *(temp + pos) != '\0' && isspace(*(temp + pos)) ) pos++; |
902 |
if ( *(temp + pos) != '\0' ){ |
952 |
if ( *(temp + pos) != '\0' ){ |
903 |
log_set_priority(LOG_ERR); |
953 |
if (log){ |
904 |
log_msg("syntax error parsing user config: line %d", lineno); |
954 |
log_set_priority(LOG_ERR); |
|
|
955 |
log_msg("syntax error parsing user config: line %d", lineno); |
956 |
} |
905 |
return FALSE; |
957 |
return FALSE; |
906 |
} |
958 |
} |
907 |
|
959 |
|
908 |
/* now finally validate the umask */ |
960 |
/* now finally validate the umask */ |
909 |
if ( !validate_umask(mask, &tmpmask) ){ |
961 |
if ( !validate_umask(mask, &tmpmask) ){ |
910 |
log_set_priority(LOG_WARNING); |
962 |
if (log){ |
911 |
log_msg("line %d: invalid umask specified, using default", |
963 |
log_set_priority(LOG_WARNING); |
|
|
964 |
log_msg("line %d: invalid umask specified, using default", |
912 |
lineno); |
965 |
lineno); |
|
|
966 |
} |
913 |
tmpmask = 077; |
967 |
tmpmask = 077; |
914 |
} |
968 |
} |
915 |
log_set_priority(LOG_INFO); |
969 |
if (log){ |
916 |
log_msg("setting %s's umask to %#o", user, tmpmask); |
970 |
log_set_priority(LOG_INFO); |
|
|
971 |
log_msg("setting %s's umask to %#o", user, tmpmask); |
972 |
} |
917 |
opts->rssh_umask = tmpmask; |
973 |
opts->rssh_umask = tmpmask; |
918 |
|
974 |
|
919 |
/* set the rest of the parameters */ |
975 |
/* set the rest of the parameters */ |
Link Here
|
922 |
opts->shell_flags = 0; |
978 |
opts->shell_flags = 0; |
923 |
/* now set the user-specific flags */ |
979 |
/* now set the user-specific flags */ |
924 |
if ( allow_scp ){ |
980 |
if ( allow_scp ){ |
925 |
log_msg("allowing scp to user %s", user); |
981 |
if (log) log_msg("allowing scp to user %s", user); |
926 |
opts->shell_flags |= RSSH_ALLOW_SCP; |
982 |
opts->shell_flags |= RSSH_ALLOW_SCP; |
927 |
} |
983 |
} |
928 |
if ( allow_sftp ){ |
984 |
if ( allow_sftp ){ |
929 |
log_msg("allowing sftp to user %s", user); |
985 |
if (log) log_msg("allowing sftp to user %s", user); |
930 |
opts->shell_flags |= RSSH_ALLOW_SFTP; |
986 |
opts->shell_flags |= RSSH_ALLOW_SFTP; |
931 |
} |
987 |
} |
932 |
if ( allow_cvs ){ |
988 |
if ( allow_cvs ){ |
933 |
log_msg("allowing cvs to user %s", user); |
989 |
if (log) log_msg("allowing cvs to user %s", user); |
934 |
opts->shell_flags |= RSSH_ALLOW_CVS; |
990 |
opts->shell_flags |= RSSH_ALLOW_CVS; |
935 |
} |
991 |
} |
936 |
if ( allow_rdist ){ |
992 |
if ( allow_rdist ){ |
937 |
log_msg("allowing rdist to user %s", user); |
993 |
if (log) log_msg("allowing rdist to user %s", user); |
938 |
opts->shell_flags |= RSSH_ALLOW_RDIST; |
994 |
opts->shell_flags |= RSSH_ALLOW_RDIST; |
939 |
} |
995 |
} |
940 |
if ( allow_rsync ){ |
996 |
if ( allow_rsync ){ |
941 |
log_msg("allowing rsync to user %s", user); |
997 |
if (log) log_msg("allowing rsync to user %s", user); |
942 |
opts->shell_flags |= RSSH_ALLOW_RSYNC; |
998 |
opts->shell_flags |= RSSH_ALLOW_RSYNC; |
943 |
} |
999 |
} |
944 |
if ( path ){ |
1000 |
if ( path ){ |
945 |
log_msg("chrooting %s to %s", user, path); |
1001 |
if (log) log_msg("chrooting %s to %s", user, path); |
946 |
opts->shell_flags |= RSSH_USE_CHROOT; |
1002 |
opts->shell_flags |= RSSH_USE_CHROOT; |
947 |
} |
1003 |
} |
948 |
opts->chroot_path = path; |
1004 |
opts->chroot_path = path; |
Link Here
|
961 |
|
1017 |
|
962 |
/* make sure '=' is next token, otherwise syntax error */ |
1018 |
/* make sure '=' is next token, otherwise syntax error */ |
963 |
if ( (pos = eat_assignment(line)) <= 0 ){ |
1019 |
if ( (pos = eat_assignment(line)) <= 0 ){ |
964 |
log_set_priority(LOG_ERR); |
1020 |
if (log){ |
965 |
log_msg("error parsing config file at line %d: " |
1021 |
log_set_priority(LOG_ERR); |
|
|
1022 |
log_msg("error parsing config file at line %d: " |
966 |
"assignment expected", lineno); |
1023 |
"assignment expected", lineno); |
|
|
1024 |
} |
967 |
return FALSE; |
1025 |
return FALSE; |
968 |
} |
1026 |
} |
969 |
/* get the string parameter of the assignment */ |
1027 |
/* get the string parameter of the assignment */ |
970 |
if ( !(len = get_token((line + pos), buf, buflen, FALSE, FALSE)) ){ |
1028 |
if ( !(len = get_token((line + pos), buf, buflen, FALSE, FALSE)) ){ |
971 |
log_set_priority(LOG_ERR); |
1029 |
if (log){ |
972 |
log_msg("syntax error parsing config file, line %d", lineno); |
1030 |
log_set_priority(LOG_ERR); |
|
|
1031 |
log_msg("syntax error parsing config file, line %d", |
1032 |
lineno); |
1033 |
} |
973 |
return FALSE; |
1034 |
return FALSE; |
974 |
} |
1035 |
} |
975 |
pos += len; |
1036 |
pos += len; |
976 |
/* check for ending comment */ |
1037 |
/* check for ending comment */ |
977 |
if ( !eat_comment(line + pos) ){ |
1038 |
if ( !eat_comment(line + pos) ){ |
978 |
log_set_priority(LOG_ERR); |
1039 |
if (log){ |
979 |
log_msg("syntax error parsing config file at line %d", lineno); |
1040 |
log_set_priority(LOG_ERR); |
|
|
1041 |
log_msg("syntax error parsing config file at line %d", |
1042 |
lineno); |
1043 |
} |
980 |
return FALSE; |
1044 |
return FALSE; |
981 |
} |
1045 |
} |
982 |
return pos; |
1046 |
return pos; |