Skip to content

Commit

Permalink
remove proxy authentication because it is not tested
Browse files Browse the repository at this point in the history
  • Loading branch information
julien4215 committed Nov 12, 2024
1 parent 7110db8 commit 89afcbf
Showing 1 changed file with 7 additions and 35 deletions.
42 changes: 7 additions & 35 deletions corkwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ char *base64_encode(char *in) {
}

void usage(void) {
printf("Usage: corkwin <proxyhost> <proxyport> <desthost> <destport> "
"[authfile]\n");
printf("Usage: corkwin <proxyhost> <proxyport> <desthost> <destport>\n");
}

/*
Expand Down Expand Up @@ -149,36 +148,14 @@ int __cdecl main(int argc, char **argv) {

port = "80";

if (argc == 5 || argc == 6) {
if (argc == 5) {
host = argv[1];
port = argv[2];
desthost = argv[3];
destport = argv[4];
up = getenv("CORKSCREW_AUTH");
}
if (argc == 6) {
host = argv[1];
port = argv[2];
desthost = argv[3];
destport = argv[4];
fp = fopen(argv[5], "r");
if (fp == NULL) {
fprintf(stderr, "Error opening %s: %s\n", argv[5], strerror(errno));
exit(-1);
} else {
if (!fscanf(fp, "%4095s", line)) {
fprintf(stderr, "Error reading auth file's content\n");
exit(-1);
}

up = line;
fclose(fp);
}
}
if (argc == 5) {
host = argv[1];
port = argv[2];
desthost = argv[3];
destport = argv[4];
} else {
usage();
exit(-1);
return -1;
}

// Initialize Winsock
Expand Down Expand Up @@ -235,11 +212,6 @@ int __cdecl main(int argc, char **argv) {
strncat(uri, ":", sizeof(uri) - strlen(uri) - 1);
strncat(uri, destport, sizeof(uri) - strlen(uri) - 1);
strncat(uri, " HTTP/1.0", sizeof(uri) - strlen(uri) - 1);
if (up != NULL) {
strncat(uri, "\nProxy-Authorization: Basic ",
sizeof(uri) - strlen(uri) - 1);
strncat(uri, base64_encode(up), sizeof(uri) - strlen(uri) - 1);
}
strncat(uri, linefeed, sizeof(uri) - strlen(uri) - 1);

iResult = send(ConnectSocket, uri, (int)strlen(uri), 0);
Expand Down

0 comments on commit 89afcbf

Please sign in to comment.