Add password handling logic to not display the password on the
command line. Code is based on logic from:
http://dev.kryo.se/iodine/browser/src/common.c
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <pcre.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <pcre.h>
#define zalloc(size) calloc(size, 1)
#define zalloc(size) calloc(size, 1)
+void read_password(char *buf, size_t len)
+{
+ char pwd[80];
+ struct termios old;
+ struct termios tp;
+
+ tcgetattr(0, &tp);
+ old = tp;
+
+ tp.c_lflag &= (~ECHO);
+ tcsetattr(0, TCSANOW, &tp);
+
+ fprintf(stdout, "Enter twitter password: ");
+ fflush(stdout);
+ scanf("%79s", pwd);
+ fprintf(stdout, "\n");
+
+ tcsetattr(0, TCSANOW, &old);
+
+ strncpy(buf, pwd, len);
+ buf[len-1] = '\0';
+}
+
static int find_urls(const char *tweet, int **pranges)
{
/*
static int find_urls(const char *tweet, int **pranges)
{
/*
struct session *session;
pid_t child;
char *tweet;
struct session *session;
pid_t child;
char *tweet;
+ static char password[80];
int retval = 0;
int option;
char *http_proxy;
int retval = 0;
int option;
char *http_proxy;
}
if (!session->password) {
}
if (!session->password) {
- fprintf(stdout, "Enter twitter password: ");
- session->password = readline(NULL);
+ read_password(password, sizeof(password));
+ session->password = strdup(password);
+ free(password);
}
if (session->action == ACTION_UPDATE) {
}
if (session->action == ACTION_UPDATE) {