diff --git a/.gitignore b/.gitignore index bbb2cc09..e9ffff30 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ /unix/Pterm.app /fuzzterm /testbn +/cgtest /*.DSA /*.RSA /*.cnt diff --git a/Recipe b/Recipe index 52fe3f4e..59ac7d56 100644 --- a/Recipe +++ b/Recipe @@ -311,10 +311,12 @@ puttytel : [X] GTKTERM uxmisc misc ldisc settings uxsel U_BE_NOSSH plink : [U] uxplink uxcons NONSSH UXSSH U_BE_ALL logging UXMISC uxsignal + ux_x11 noterm -puttygen : [U] cmdgen sshrsag sshdssg sshprime sshdes sshbn sshmd5 version +PUTTYGEN_UNIX = sshrsag sshdssg sshprime sshdes sshbn sshmd5 version + sshrand uxnoise sshsha misc sshrsa sshdss uxcons uxstore uxmisc + sshpubk sshaes sshsh256 sshsh512 IMPORT puttygen.res time tree234 + uxgen notiming conf sshecc sshecdsag +puttygen : [U] cmdgen PUTTYGEN_UNIX +cgtest : [UT] cgtest PUTTYGEN_UNIX pscp : [U] pscp uxsftp uxcons UXSSH BE_SSH SFTP wildcard UXMISC psftp : [U] psftp uxsftp uxcons UXSSH BE_SSH SFTP wildcard UXMISC diff --git a/cgtest.c b/cgtest.c new file mode 100644 index 00000000..095ce722 --- /dev/null +++ b/cgtest.c @@ -0,0 +1,6 @@ +/* + * cgtest.c: stub file to compile cmdgen.c in self-test mode + */ + +#define TEST_CMDGEN +#include "cmdgen.c" diff --git a/cmdgen.c b/cmdgen.c index 4e83336c..ac56ab3e 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -19,7 +19,7 @@ #ifdef TEST_CMDGEN /* * This section overrides some definitions below for test purposes. - * When compiled with -DTEST_CMDGEN: + * When compiled with -DTEST_CMDGEN (as cgtest.c will do): * * - Calls to get_random_data() are replaced with the diagnostic * function below (I #define the name so that I can still link @@ -52,8 +52,7 @@ int console_get_userpass_input(prompts_t *p, unsigned char *in, int inlen) int ret = 1; for (i = 0; i < p->n_prompts; i++) { if (promptsgot < nprompts) { - assert(strlen(prompts[promptsgot]) < p->prompts[i]->result_len); - strcpy(p->prompts[i]->result, prompts[promptsgot++]); + p->prompts[i]->result = dupstr(prompts[promptsgot++]); } else { promptsgot++; /* track number of requests anyway */ ret = 0; @@ -1193,7 +1192,7 @@ char *cleanup_fp(char *s) s += strspn(s, " \n\t"); s += strcspn(s, " \n\t"); - return dupprintf("%.*s", s - p, p); + return dupprintf("%.*s", (int)(s - p), p); } char *get_fp(char *filename)