Fixes for external protocols
This commit is contained in:
parent
380375bd99
commit
d386f58b08
@ -6,3 +6,15 @@ Upload Prompt = false
|
|||||||
Upload Command = rz -R
|
Upload Command = rz -R
|
||||||
Download Command = sz *f
|
Download Command = sz *f
|
||||||
stdio = true
|
stdio = true
|
||||||
|
|
||||||
|
[LRZSZ Ymodem]
|
||||||
|
Upload Prompt = false
|
||||||
|
Upload Command = rb -R
|
||||||
|
Download Command = sb *f
|
||||||
|
stdio = true
|
||||||
|
|
||||||
|
[LRZSZ XModem]
|
||||||
|
Upload Prompt = true
|
||||||
|
Upload Command = rx -R *f
|
||||||
|
Download Command = sx *f
|
||||||
|
stdio = true
|
||||||
|
19
files.c
19
files.c
@ -336,6 +336,8 @@ int do_download(struct user_record *user, char *file) {
|
|||||||
int last_char_space;
|
int last_char_space;
|
||||||
char **arguments;
|
char **arguments;
|
||||||
int bpos;
|
int bpos;
|
||||||
|
int len;
|
||||||
|
|
||||||
if (conf.protocols[user->defprotocol - 1]->internal_zmodem) {
|
if (conf.protocols[user->defprotocol - 1]->internal_zmodem) {
|
||||||
if (sshBBS) {
|
if (sshBBS) {
|
||||||
ttySetRaw(STDIN_FILENO, &oldit);
|
ttySetRaw(STDIN_FILENO, &oldit);
|
||||||
@ -379,9 +381,10 @@ int do_download(struct user_record *user, char *file) {
|
|||||||
|
|
||||||
bpos = 1;
|
bpos = 1;
|
||||||
arguments = (char **)malloc(sizeof(char *) * (argc + 1));
|
arguments = (char **)malloc(sizeof(char *) * (argc + 1));
|
||||||
|
len = strlen(download_command);
|
||||||
for (i=0;i<strlen(download_command);i++) {
|
for (i=0;i<len;) {
|
||||||
if (download_command[i] != ' ') {
|
if (download_command[i] != ' ') {
|
||||||
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,6 +419,7 @@ int do_upload(struct user_record *user, char *final_path) {
|
|||||||
DIR *inb;
|
DIR *inb;
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
int len;
|
||||||
|
|
||||||
if (conf.protocols[user->defprotocol - 1]->internal_zmodem) {
|
if (conf.protocols[user->defprotocol - 1]->internal_zmodem) {
|
||||||
upload_zmodem(user, final_path);
|
upload_zmodem(user, final_path);
|
||||||
@ -470,9 +474,10 @@ int do_upload(struct user_record *user, char *final_path) {
|
|||||||
}
|
}
|
||||||
bpos = 1;
|
bpos = 1;
|
||||||
arguments = (char **)malloc(sizeof(char *) * (argc + 1));
|
arguments = (char **)malloc(sizeof(char *) * (argc + 1));
|
||||||
|
len = strlen(upload_command);
|
||||||
for (i=0;i<strlen(upload_command);i++) {
|
for (i=0;i<len;) {
|
||||||
if (upload_command[i] != ' ') {
|
if (upload_command[i] != ' ') {
|
||||||
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,6 +491,10 @@ int do_upload(struct user_record *user, char *final_path) {
|
|||||||
}
|
}
|
||||||
arguments[bpos] = NULL;
|
arguments[bpos] = NULL;
|
||||||
|
|
||||||
|
for (i=0;i<bpos;i++) {
|
||||||
|
printf("\"%s\"\n", arguments[i]);
|
||||||
|
}
|
||||||
|
|
||||||
arguments[0] = upload_command;
|
arguments[0] = upload_command;
|
||||||
|
|
||||||
snprintf(upload_path, 1024, "%s/node%d/upload/", conf.bbs_path, mynode);
|
snprintf(upload_path, 1024, "%s/node%d/upload/", conf.bbs_path, mynode);
|
||||||
@ -502,7 +511,7 @@ int do_upload(struct user_record *user, char *final_path) {
|
|||||||
|
|
||||||
if (conf.protocols[user->defprotocol - 1]->upload_prompt) {
|
if (conf.protocols[user->defprotocol - 1]->upload_prompt) {
|
||||||
snprintf(upload_command, 1024, "%s%s", upload_path, buffer3);
|
snprintf(upload_command, 1024, "%s%s", upload_path, buffer3);
|
||||||
if (stat(buffer3, &s) != 0) {
|
if (stat(upload_command, &s) != 0) {
|
||||||
recursive_delete(upload_path);
|
recursive_delete(upload_path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ Is this Correct? (Y/N)
|
|||||||
\e[1;31m%d. \e[1;37m%s\e[0m\r\n
|
\e[1;31m%d. \e[1;37m%s\e[0m\r\n
|
||||||
>
|
>
|
||||||
Sorry, this %s is unavailable over SSH\r\n
|
Sorry, this %s is unavailable over SSH\r\n
|
||||||
Please enter the filename of the file you want to upload\r\n>
|
\r\n\r\nPlease enter the filename of the file you want to upload\r\n>
|
||||||
\r\nUpload Failed\r\n
|
\r\nUpload Failed\r\n
|
||||||
\r\n\e[1;32mSelect a protocol...\e[0m\r\n\r\n
|
\r\n\e[1;32mSelect a protocol...\e[0m\r\n\r\n
|
||||||
\e[0;36mO. \e[1;37mDefault Protocol (\e[1;33m%s\e[1;37m)\r\n
|
\e[0;36mO. \e[1;37mDefault Protocol (\e[1;33m%s\e[1;37m)\r\n
|
||||||
|
Reference in New Issue
Block a user