239
241
"Authenticated successfully.");
245
* Displays input prompt on command line and takes input data from user
246
* From irssi-silc (silc-client/lib/silcutil/silcutil.c)
251
char input[2048], *ret = NULL;
254
#ifndef DISABLE_TERMIOS
256
struct termios to_old;
258
if ((fd = open("/dev/tty", O_RDONLY)) < 0) {
259
g_warning("Cannot open /dev/tty: %s\n",
263
signal(SIGINT, SIG_IGN);
265
/* Get terminal info */
268
/* Echo OFF, and assure we can prompt and get input */
269
to.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
270
to.c_lflag |= ICANON;
272
tcsetattr(fd, TCSANOW, &to);
274
printf("\tXMPP Password: ");
277
memset(input, 0, sizeof(input));
278
if ((read(fd, input, sizeof(input))) < 0) {
279
g_warning("Cannot read from /dev/tty: %s\n",
281
tcsetattr(fd, TCSANOW, &to_old);
284
if (strlen(input) <= 1) {
285
tcsetattr(fd, TCSANOW, &to_old);
288
if ((ret = strchr(input, '\n')) != NULL)
291
/* Restore old terminfo */
292
tcsetattr(fd, TCSANOW, &to_old);
293
signal(SIGINT, SIG_DFL);
295
ret = g_strdup(input);
296
memset(input, 0, sizeof(input));
297
#endif /* DISABLE_TERMIOS */
243
302
lm_open_cb(LmConnection *connection, gboolean success,
244
303
gpointer user_data)
265
324
signal_emit("xmpp server status", 2, server,
266
325
"Using STARTTLS encryption.");
267
326
recoded_user = xmpp_recode_out(server->user);
328
if (server->connrec->password == NULL
329
|| *(server->connrec->password) == '\0'
330
|| *(server->connrec->password) == '\r') {
331
if (server->connrec->password != NULL)
332
g_free(server->connrec->password);
333
server->connrec->password = get_password();
334
if (server->connrec->password == NULL)
335
server->connrec->password = g_strdup(" ");
268
337
recoded_password = xmpp_recode_out(server->connrec->password);
269
338
recoded_resource = xmpp_recode_out(server->resource);
270
339
lm_connection_authenticate(connection, recoded_user,