Onion Services should perfectly work now
This commit is contained in:
parent
1eb247d925
commit
3dde9d5344
2 changed files with 11 additions and 3 deletions
|
@ -39,9 +39,12 @@ int tor_ctl_add_onion(struct tor_ctl* ctx, struct tor_os_str* tos, int* port) {
|
|||
for (int i = 0; i < tos->filled; i++) {
|
||||
fprintf(ctx->wsock, "add_onion %s Port=%d\n", tos->list[i], port[i]);
|
||||
fscanf(ctx->rsock, "%d", &err);
|
||||
if (err != 250) return -1;
|
||||
if (err != 250) {
|
||||
printf("err: %d\n", err);
|
||||
return -1;
|
||||
}
|
||||
fscanf(ctx->rsock, "-ServiceID=%s", buffer);
|
||||
printf("Added onion service %s from file", buffer);
|
||||
printf("Added onion service %s from file\n", buffer);
|
||||
fscanf(ctx->rsock, "250 OK");
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,17 @@ void tor_os_read (struct tor_os_str* os) {
|
|||
return;
|
||||
}
|
||||
size_t len = 0;
|
||||
size_t str_len = 0;
|
||||
int n = 0;
|
||||
while (1) {
|
||||
char** dst = tor_os_append_cursor(os);
|
||||
if (dst == NULL) break;
|
||||
if (getline(dst,&len,fd) == -1) break;
|
||||
str_len = strlen(*dst);
|
||||
if (str_len < 1) break;
|
||||
if ((*dst)[str_len - 1] == '\n') {
|
||||
(*dst)[str_len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
}
|
||||
|
@ -60,7 +66,6 @@ void tor_os_persist(struct tor_os_str* os) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < os->filled; i++) {
|
||||
printf("%s\n", os->list[i]);
|
||||
fprintf(fd, "%s\n", os->list[i]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue