30 #define DISABLE_DEBUGLOG
41 #include <gwenhywfar/gui_be.h>
42 #include <gwenhywfar/inherit.h>
43 #include <gwenhywfar/debug.h>
44 #include <gwenhywfar/misc.h>
45 #include <gwenhywfar/db.h>
46 #include <gwenhywfar/gwentime.h>
47 #include <gwenhywfar/mdigest.h>
48 #include <gwenhywfar/text.h>
79 cgui->progressList=GWEN_Gui_CProgress_List_new();
108 cgui=(GWEN_GUI_CGUI*)p;
109 GWEN_Gui_CProgress_List_free(cgui->progressList);
162 #ifdef HAVE_TERMIOS_H
163 struct termios OldAttr, NewAttr;
166 #if HAVE_DECL_SIGPROCMASK
171 #if HAVE_DECL_SIGPROCMASK
173 sigaddset(&snew, SIGINT);
174 sigaddset(&snew, SIGSTOP);
175 sigprocmask(SIG_BLOCK, &snew, &sold);
177 #ifdef HAVE_TERMIOS_H
178 if (0 == tcgetattr (fileno (stdin), &OldAttr)){
180 NewAttr.c_lflag &= ~ICANON;
181 NewAttr.c_lflag &= ~ECHO;
182 tcsetattr (fileno (stdin), TCSAFLUSH, &NewAttr);
191 chr==GWEN_GUI_CGUI_CHAR_ABORT ||
192 chr==GWEN_GUI_CGUI_CHAR_ENTER ||
200 #ifdef HAVE_TERMIOS_H
203 tcsetattr (fileno (stdin), TCSADRAIN, &OldAttr);
206 #if HAVE_DECL_SIGPROCMASK
207 sigprocmask(SIG_BLOCK, &sold, 0);
221 #ifdef HAVE_TERMIOS_H
222 struct termios OldInAttr, NewInAttr;
223 struct termios OldOutAttr, NewOutAttr;
224 int AttrInChanged = 0;
225 int AttrOutChanged = 0;
230 #if HAVE_DECL_SIGPROCMASK
236 #if HAVE_DECL_SIGPROCMASK
238 sigaddset(&snew, SIGINT);
239 sigaddset(&snew, SIGSTOP);
240 sigprocmask(SIG_BLOCK, &snew, &sold);
243 #ifdef HAVE_TERMIOS_H
244 if (0 == tcgetattr (fileno (stdin), &OldInAttr)){
245 NewInAttr = OldInAttr;
246 NewInAttr.c_lflag &= ~ECHO;
247 NewInAttr.c_lflag &= ~ICANON;
248 tcsetattr (fileno (stdin), TCSAFLUSH, &NewInAttr);
251 if (0 == tcgetattr (fileno (stderr), &OldOutAttr)){
252 NewOutAttr = OldOutAttr;
253 NewOutAttr.c_lflag &= ~ICANON;
254 tcsetattr (fileno (stderr), TCSAFLUSH, &NewOutAttr);
263 if (chr==GWEN_GUI_CGUI_CHAR_DELETE) {
266 fprintf(stderr,
"%c %c", 8, 8);
269 else if (chr==GWEN_GUI_CGUI_CHAR_ENTER) {
270 if (minLen && pos<minLen) {
276 I18N(
"Your input was empty.\n"
277 "Do you want to use the default?"),
280 I18N(
"Abort"), guiid);
292 fprintf(stderr,
"\007");
296 fprintf(stderr,
"\n");
304 if (chr==GWEN_GUI_CGUI_CHAR_ABORT) {
313 fprintf(stderr,
"\007");
317 fprintf(stderr,
"%c", chr);
319 fprintf(stderr,
"*");
327 fprintf(stderr,
"\007");
332 #ifdef HAVE_TERMIOS_H
335 tcsetattr (fileno (stderr), TCSADRAIN, &OldOutAttr);
337 tcsetattr (fileno (stdin), TCSADRAIN, &OldInAttr);
340 #if HAVE_DECL_SIGPROCMASK
341 sigprocmask(SIG_BLOCK, &sold, 0);
370 "Got the following dangerous message:\n%s\n",
377 "Auto-answering the following message with %d:\n%s",
385 fprintf(stderr,
"===== %s =====\n", title);
391 fprintf(stderr,
"(1) %s", b1);
393 fprintf(stderr,
" (2) %s", b2);
395 fprintf(stderr,
" (3) %s", b3);
398 fprintf(stderr,
"\n");
400 fprintf(stderr,
"Please enter your choice: ");
404 fprintf(stderr,
"Aborted.\n");
410 fprintf(stderr,
"1\n");
413 else if (c==
'2' && b2) {
414 fprintf(stderr,
"2\n");
417 else if (c==
'3' && b3) {
418 fprintf(stderr,
"3\n");
422 fprintf(stderr,
"%c", 7);
445 fprintf(stderr,
"===== %s =====\n", title);
454 lbuffer=(
char*)malloc(maxLen);
459 fprintf(stderr,
"Input: ");
466 fprintf(stderr,
"Again: ");
472 if (strcmp(lbuffer, buffer)!=0) {
474 "ERROR: Entries do not match, please try (again or abort)\n");
484 fprintf(stderr,
"Input: ");
508 fprintf(stderr,
"----- %s -----\n", title);
513 return ++(cgui->nextBoxId);
531 uint32_t progressFlags,
544 ++(cgui->nextProgressId),
549 GWEN_Gui_CProgress_List_Insert(cp, cgui->progressList);
563 cp=GWEN_Gui_CProgress_List_First(cgui->progressList);
569 cp=GWEN_Gui_CProgress_List_Next(cp);
639 GWEN_Gui_CProgress_List_Del(cp);
711 "Automatically accepting certificate [%s]",
723 "Automatically accepting valid new certificate [%s]",
730 "Automatically rejecting certificate [%s] (noninteractive)",
737 if (cgui->checkCertFn) {
738 i=cgui->checkCertFn(gui, cd, sio, guiid);
767 if (cgui->persistentPasswords==0)
781 if (cgui->persistentPasswords==0)
833 if (i>=minLen && i < maxLen) {
834 memmove(buffer, s, i+1);
847 "Password for [%s] missing in noninteractive mode, "
882 "You entered the same PIN twice.\n"
883 "The PIN is marked as bad, do you want\n"
887 "You entered the same PIN twice."
890 "The PIN is marked as <b>bad</b>, "
891 "do you want to use it anyway?"
894 I18N(
"Use my input"),
928 cgui->dbPasswords=dbPasswords;
929 cgui->persistentPasswords=persistent;
941 return cgui->dbPasswords;
954 cgui->dbCerts=dbCerts;
966 return cgui->dbCerts;