Mercurial > dropbear
comparison cli-runopts.c @ 1218:b73c078e11e9
Don't allow spaces and don't get confused by -o usesyslogd=yes
(option name has another option name as a prefix)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Dec 2015 22:23:42 +0800 |
parents | 980b7ea2c5ef |
children | de2e39e94c68 |
comparison
equal
deleted
inserted
replaced
1217:980b7ea2c5ef | 1218:b73c078e11e9 |
---|---|
822 dropbear_exit("Bad TCP port in '%s'", origstr); | 822 dropbear_exit("Bad TCP port in '%s'", origstr); |
823 } | 823 } |
824 #endif | 824 #endif |
825 | 825 |
826 static int match_extendedopt(const char** strptr, const char *optname) { | 826 static int match_extendedopt(const char** strptr, const char *optname) { |
827 int seen_eq = 0; | |
828 int optlen = strlen(optname); | 827 int optlen = strlen(optname); |
829 const char *str = *strptr; | 828 const char *str = *strptr; |
830 | 829 |
831 while (isspace(*str)) { | |
832 ++str; | |
833 } | |
834 | |
835 if (strncasecmp(str, optname, optlen) != 0) { | 830 if (strncasecmp(str, optname, optlen) != 0) { |
836 return DROPBEAR_FAILURE; | 831 return DROPBEAR_FAILURE; |
837 } | 832 } |
838 | 833 |
839 str += optlen; | 834 str += optlen; |
840 | 835 |
841 while (isspace(*str) || (!seen_eq && *str == '=')) { | 836 if (*str == '=') { |
842 if (*str == '=') { | 837 *strptr = str+1; |
843 seen_eq = 1; | 838 return DROPBEAR_SUCCESS; |
844 } | 839 } else { |
845 ++str; | 840 return DROPBEAR_FAILURE; |
846 } | 841 } |
847 | 842 |
848 *strptr = str; | |
849 return DROPBEAR_SUCCESS; | |
850 } | 843 } |
851 | 844 |
852 static int parse_flag_value(const char *value) { | 845 static int parse_flag_value(const char *value) { |
853 if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0) { | 846 if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0) { |
854 return 1; | 847 return 1; |