comparison cli-authinteract.c @ 399:a707e6148060

merge of '5fdf69ca60d1683cdd9f4c2595134bed26394834' and '6b61c50f4cf888bea302ac8fcf5dbb573b443251'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:34 +0000
parents 31743c9bdf78
children a24139ba08c8
comparison
equal deleted inserted replaced
394:17d097fc111c 399:a707e6148060
97 buf_putint(ses.writepayload, num_prompts); 97 buf_putint(ses.writepayload, num_prompts);
98 98
99 if (strlen(name) > 0) { 99 if (strlen(name) > 0) {
100 cleantext(name); 100 cleantext(name);
101 fprintf(stderr, "%s", name); 101 fprintf(stderr, "%s", name);
102 m_free(name);
103 } 102 }
103 m_free(name);
104
104 if (strlen(instruction) > 0) { 105 if (strlen(instruction) > 0) {
105 cleantext(instruction); 106 cleantext(instruction);
106 fprintf(stderr, "%s", instruction); 107 fprintf(stderr, "%s", instruction);
107 m_free(instruction);
108 } 108 }
109 m_free(instruction);
109 110
110 for (i = 0; i < num_prompts; i++) { 111 for (i = 0; i < num_prompts; i++) {
111 unsigned int response_len = 0; 112 unsigned int response_len = 0;
112 prompt = buf_getstring(ses.payload, NULL); 113 prompt = buf_getstring(ses.payload, NULL);
113 cleantext(prompt); 114 cleantext(prompt);
114 115
115 echo = buf_getbool(ses.payload); 116 echo = buf_getbool(ses.payload);
116 117
117 if (!echo) { 118 if (!echo) {
118 unsigned char* p = getpass(prompt); 119 unsigned char* p = getpass_or_cancel(prompt);
119 response = m_strdup(p); 120 response = m_strdup(p);
120 m_burn(p, strlen(p)); 121 m_burn(p, strlen(p));
121 } else { 122 } else {
122 response = get_response(prompt); 123 response = get_response(prompt);
123 } 124 }