Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cookies: bugfix: break outside debug statement

  • Loading branch information...
commit bb856cd325644d56c4da765075f338ee05e92554 1 parent 94f9aad
@falconindy authored
Showing with 12 additions and 12 deletions.
  1. +6 −4 burp.c
  2. +6 −8 cookies.c
View
10 burp.c
@@ -124,6 +124,8 @@ static int read_config_file() {
config->cookies = strdup(p.we_wordv[0]);
if (config->verbose >= 2)
printf("::DEBUG:: Using cookie file: %s\n", config->cookies);
+ } else {
+ fprintf(stderr, "Ambiguous path to cookie file. Ignoring config option.\n");
}
wordfree(&p);
} else {
@@ -311,10 +313,10 @@ int main(int argc, char **argv) {
cleanup(ret);
}
- /* We can't read the config file without having verbosity set, but
- * the command line options need to take precedence over the config.
- * file. Therefore, if a user/pass OR a cookie file is supplied on
- * the command line, we won't read the config file.
+ /* We can't read the config file without having verbosity set, but the
+ * command line options need to take precedence over the config. file.
+ * Therefore, if ((user && pass) || cookie file) is supplied on the command
+ * line, we won't read the config file.
*/
if (! ((config->user && config->password) || config->cookies))
read_config_file();
View
14 cookies.c
@@ -20,8 +20,8 @@ long cookie_expire_time(const char *cookie_file,
expire = 0;
fd = fopen(cookie_file, "r");
- while ((lptr = fgets(&line[0], COOKIE_SIZE, fd)) != NULL) {
- lptr = strtrim(lptr);
+ while ((lptr = fgets(&line[0], COOKIE_SIZE, fd))) {
+ strtrim(lptr);
if (*lptr == '#' || strlen(lptr) == 0)
continue;
@@ -30,11 +30,9 @@ long cookie_expire_time(const char *cookie_file,
if (STREQ(domain, cookie->domain) && STREQ(name, cookie->name)) {
expire = cookie->expire;
- if (config->verbose > 1) {
- printf("::DEBUG:: Appropriate cookie found with expire time of %ld\n",
- cookie->expire);
- break;
- }
+ if (config->verbose > 1)
+ printf("::DEBUG:: Cookie found (expires %ld)\n", expire);
+ break;
}
}
fclose(fd);
@@ -48,7 +46,7 @@ struct cookie_t *cookie_to_struct(char *co, struct cookie_t **cookie) {
(*cookie)->domain = strtok(co, "\t");
(*cookie)->secure = STREQ(strtok(NULL, "\t"), "TRUE") ? 1 : 0;
(*cookie)->path = strtok(NULL, "\t");
- (*cookie)->httponly = STREQ(strtok(NULL, "\t"), "TRUE") ? 1: 0;
+ (*cookie)->httponly = STREQ(strtok(NULL, "\t"), "TRUE") ? 1 : 0;
(*cookie)->expire = strtol(strtok(NULL, "\t"), NULL, 10);
(*cookie)->name = strtok(NULL, "\t");
(*cookie)->value = strtok(NULL, "\t");
Please sign in to comment.
Something went wrong with that request. Please try again.