summaryrefslogtreecommitdiff
path: root/community/electricsheep/electricsheep-pref-segfault.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/electricsheep/electricsheep-pref-segfault.patch')
-rw-r--r--community/electricsheep/electricsheep-pref-segfault.patch270
1 files changed, 270 insertions, 0 deletions
diff --git a/community/electricsheep/electricsheep-pref-segfault.patch b/community/electricsheep/electricsheep-pref-segfault.patch
new file mode 100644
index 000000000..83bcd8a0f
--- /dev/null
+++ b/community/electricsheep/electricsheep-pref-segfault.patch
@@ -0,0 +1,270 @@
+diff -Naur electricsheep-2.7b12/electricsheep.c electricsheep-2.7~b12+svn20091224/electricsheep.c
+--- electricsheep-2.7b12/electricsheep.c 2009-07-09 04:10:05.000000000 -0400
++++ electricsheep-2.7~b12+svn20091224/electricsheep.c 2009-12-24 18:03:01.000000000 -0500
+@@ -564,6 +566,12 @@
+ n++;
+ }
+ }
++ if (n < 1) {
++ if (debug) {
++ fprintf(logout, "median rank undefined\n");
++ }
++ return;
++ }
+ qsort(tms, n, sizeof(int), compare_ints);
+ if (0 && debug) {
+ for (i = 0; i < n; i++)
+@@ -1915,7 +1923,7 @@
+ if (-1 == (decoder_pid = fork())) {
+ perror("decoder fork");
+ } else if (0 == decoder_pid) {
+- char *argv[20];
++ char *argv[25];
+ int c = 0;
+ /* child */
+ snprintf(fps, 24, "%g", prefs.frame_rate);
+@@ -1934,6 +1942,7 @@
+ cleanup_and_exit(1);
+ }
+ argv[c++] = "mplayer";
++ argv[c++] = "-nolirc";
+ argv[c++] = "-cache";
+ argv[c++] = "8192";
+ argv[c++] = "-really-quiet";
+diff -Naur electricsheep-2.7b12/electricsheep.h electricsheep-2.7~b12+svn20091224/electricsheep.h
+--- electricsheep-2.7b12/electricsheep.h 2009-07-09 04:10:05.000000000 -0400
++++ electricsheep-2.7~b12+svn20091224/electricsheep.h 2009-12-24 18:03:01.000000000 -0500
+@@ -74,4 +74,4 @@
+ void init_list_cmd (char *buf);
+ void get_end_element(void *userData, const char *name);
+ void character_handler(void *userData, const XML_Char *s, int len);
+-char *encry(char *pw);
++char *encry(char *pw, char *nick);
+diff -Naur electricsheep-2.7b12/electricsheep-preferences.c electricsheep-2.7~b12+svn20091224/electricsheep-preferences.c
+--- electricsheep-2.7b12/electricsheep-preferences.c 2009-07-09 04:10:05.000000000 -0400
++++ electricsheep-2.7~b12+svn20091224/electricsheep-preferences.c 2009-12-24 18:03:01.000000000 -0500
+@@ -108,8 +108,9 @@
+ prefs.password = strdup("");
+ } else {
+ char *pw = (char*)gtk_entry_get_text(password_entry);
++ pw = strdup(pw);
+ if (strcmp(pw, pw_marker))
+- prefs.password = encry(pw);
++ prefs.password = encry(pw, prefs.nick);
+ }
+ prefs.video_driver = (char*)gtk_entry_get_text(video_driver_entry);
+ prefs.frame_rate = gtk_spin_button_get_value(frame_rate_spin);
+@@ -207,72 +208,72 @@
+ void get_widgets(GladeXML *xml) {
+ title_label = (GtkLabel *) glade_xml_get_widget(xml, "titleLabel");
+ if (NULL == title_label) {
+- fprintf(stderr, "titleLabel not found\n");
++ fprintf(logout, "titleLabel not found\n");
+ exit(1);
+ }
+ test_label = (GtkLabel *) glade_xml_get_widget(xml, "testLabel");
+ if (NULL == test_label) {
+- fprintf(stderr, "testLabel not found\n");
++ fprintf(logout, "testLabel not found\n");
+ exit(1);
+ }
+ test_button = (GtkButton *) glade_xml_get_widget(xml, "testButton");
+ if (NULL == test_button) {
+- fprintf(stderr, "testButton not found\n");
++ fprintf(logout, "testButton not found\n");
+ exit(1);
+ }
+ nick_entry = (GtkEntry *) glade_xml_get_widget(xml, "nickEntry");
+ if (NULL == nick_entry) {
+- fprintf(stderr, "nickEntry not found\n");
++ fprintf(logout, "nickEntry not found\n");
+ exit(1);
+ }
+ url_entry = (GtkEntry *) glade_xml_get_widget(xml, "urlEntry");
+ if (NULL == url_entry) {
+- fprintf(stderr, "urlEntry not found\n");
++ fprintf(logout, "urlEntry not found\n");
+ exit(1);
+ }
+ password_entry = (GtkEntry *) glade_xml_get_widget(xml, "passEntry");
+ if (NULL == password_entry) {
+- fprintf(stderr, "passEntry not found\n");
++ fprintf(logout, "passEntry not found\n");
+ exit(1);
+ }
+ video_driver_entry = (GtkEntry *) glade_xml_get_widget(xml, "vdEntry");
+ if (NULL == video_driver_entry) {
+- fprintf(stderr, "vdEntry not found\n");
++ fprintf(logout, "vdEntry not found\n");
+ exit(1);
+ }
+ frame_rate_spin = (GtkSpinButton *) glade_xml_get_widget(xml, "frameSpin");
+ if (NULL == frame_rate_spin) {
+- fprintf(stderr, "frameSpin not found\n");
++ fprintf(logout, "frameSpin not found\n");
+ exit(1);
+ }
+ nrepeats_spin = (GtkSpinButton *) glade_xml_get_widget(xml, "repeatSpin");
+ if (NULL == nrepeats_spin) {
+- fprintf(stderr, "repeatSpin not found\n");
++ fprintf(logout, "repeatSpin not found\n");
+ exit(1);
+ }
+ cache_spin = (GtkSpinButton *) glade_xml_get_widget(xml, "cacheSpin");
+ if (NULL == cache_spin) {
+- fprintf(stderr, "cacheSpin not found\n");
++ fprintf(logout, "cacheSpin not found\n");
+ exit(1);
+ }
+ no_animation_check = (GtkCheckButton *) glade_xml_get_widget(xml, "noanimCheck");
+ if (NULL == no_animation_check) {
+- fprintf(stderr, "noanimCheck not found\n");
++ fprintf(logout, "noanimCheck not found\n");
+ exit(1);
+ }
+ standalone_check = (GtkCheckButton *) glade_xml_get_widget(xml, "standaloneCheck");
+ if (NULL == standalone_check) {
+- fprintf(stderr, "standaloneCheck not found\n");
++ fprintf(logout, "standaloneCheck not found\n");
+ exit(1);
+ }
+ hide_errors_check = (GtkCheckButton *) glade_xml_get_widget(xml, "hideCheck");
+ if (NULL == hide_errors_check) {
+- fprintf(stderr, "hideCheck not found\n");
++ fprintf(logout, "hideCheck not found\n");
+ exit(1);
+ }
+ save_frames_check = (GtkCheckButton *) glade_xml_get_widget(xml, "saveCheck");
+ if (NULL == save_frames_check) {
+- fprintf(stderr, "saveCheck not found\n");
++ fprintf(logout, "saveCheck not found\n");
+ exit(1);
+ }
+ }
+diff -Naur electricsheep-2.7b12/utils.c electricsheep-2.7~b12+svn20091224/utils.c
+--- electricsheep-2.7b12/utils.c 2009-07-09 04:10:05.000000000 -0400
++++ electricsheep-2.7~b12+svn20091224/utils.c 2009-12-24 18:03:01.000000000 -0500
+@@ -69,19 +70,23 @@
+ }
+ }
+
+-char *encry(char *pw) {
++
++char *encry(char *pw, char *nick) {
++ static char *salt = "sh33p";
+ unsigned char digest[16];
+ char md5_pw[33];
++ char *pw_salted = malloc(strlen(pw) + strlen(salt) + strlen(nick) + 1);
+ int i, j;
+- md5_buffer(pw, strlen(pw), digest);
++ sprintf(pw_salted, "%s%s%s", pw, salt, nick);
++ md5_buffer(pw_salted, strlen(pw_salted), digest);
+ for (i = 0, j = 0; i < sizeof(digest); i++) {
+ char *hex_digits = "0123456789ABCDEF";
+-
+ md5_pw[j++] = hex_digits[digest[i] >> 4];
+ md5_pw[j++] = hex_digits[digest[i] & 0x0F];
+ }
+ md5_pw[j] = 0;
+ free(pw);
++ free(pw_salted);
+ return strdup(md5_pw);
+ }
+
+@@ -97,10 +102,11 @@
+ free(prefs->url);
+ prefs->url = strdup(atts[i+1]);
+ } else if (!strcmp("password", atts[i])) {
+- free(prefs->password);
+- prefs->password = encry(strdup(atts[i+1]));
++ free(prefs->password);
++ /* assume nick comes before pw in the xml XXX */
++ prefs->password = encry(strdup(atts[i+1]), prefs->nick);
+ } else if (!strcmp("password_md5", atts[i])) {
+- free(prefs->password);
++ free(prefs->password);
+ prefs->password = strdup(atts[i+1]);
+ } else if (!strcmp("video_driver", atts[i])) {
+ free(prefs->video_driver);
+@@ -133,7 +139,7 @@
+ } else if (!strcmp("version", atts[i])) {
+ // nothing to check
+ } else {
+- fprintf(stderr, "ignoring attribute %s\n", atts[i]);
++ fprintf(logout, "ignoring attribute %s\n", atts[i]);
+ }
+ i += 2;
+ }
+@@ -146,7 +152,7 @@
+ if (argc > 2)
+ strcpy(rc_file, argv[2]);
+ else {
+- fprintf(stderr,
++ fprintf(logout,
+ "%s: --preferences option requires a file name argument.\n",
+ argv[0]);
+ exit(1);
+@@ -155,7 +161,7 @@
+ }
+ hom = getenv("HOME");
+ if (!hom) {
+- fprintf(stderr, "%s: HOME envar not defined\n", argv[0]);
++ fprintf(logout, "%s: HOME envar not defined\n", argv[0]);
+ exit(1);
+ }
+ snprintf(rc_file, PATH_MAX, "%s/.electricsheep/preferences.xml", hom);
+@@ -281,15 +287,15 @@
+
+ int mysystem(char *cmd, char *msg) {
+ int n;
+- if (0) fprintf(stderr, "subprocess; (%s)\n", cmd);
++ if (0) fprintf(logout, "subprocess; (%s)\n", cmd);
+ if (0 != (n = interruptable_system(cmd))) {
+ if (SIGINT != n) {
+ if (!prefs.hide_errors)
+- fprintf(stderr, "subprocess error: %s, %d=%d<<8+%d\n",
++ fprintf(logout, "subprocess error: %s, %d=%d<<8+%d\n",
+ msg, n, n>>8, n&255);
+ return 1;
+ }
+- fprintf(stderr, "control-c during %s, exiting\n", msg);
++ fprintf(logout, "control-c during %s, exiting\n", msg);
+ cleanup_and_exit(1);
+ }
+ return 0;
+@@ -325,7 +331,7 @@
+ int bytes_read;
+ void *buff = XML_GetBuffer(parser, XML_BUFF_SIZE);
+ if (buff == NULL) {
+- fprintf(stderr, "unable to allocate buffer.\n");
++ fprintf(logout, "unable to allocate buffer.\n");
+ exit(1);
+ }
+
+@@ -334,7 +340,7 @@
+ break;
+
+ if (! XML_ParseBuffer(parser, bytes_read, bytes_read == 0)) {
+- fprintf(stderr, "parse error.\n");
++ fprintf(logout, "parse error.\n");
+ exit(1);
+ }
+ }
+@@ -441,7 +447,7 @@
+
+ void init_curl_cmd(int registration) {
+
+- if (debug) fprintf(stderr, "init_curl_cmd %d\n", registration);
++ if (debug) fprintf(logout, "init_curl_cmd %d\n", registration);
+
+ if (prefs.proxy_name) {
+ snprintf(curl_cmd, MAXBUF, "nice -n %d curl --location --proxy %s",
+@@ -472,7 +478,7 @@
+ }
+ }
+ server = dream_server;
+- if (debug) fprintf(stderr, "curl_cmd = %s\nserver = %s\n", curl_cmd, server);
++ if (debug) fprintf(logout, "curl_cmd = %s\nserver = %s\n", curl_cmd, server);
+ }
+
+ void init_list_cmd (char *buf) {