This fixes issue #77 of hgd. The null check was in the wrong place. Applying to the port as it is fairly nasty. OK?
Index: Makefile =================================================================== RCS file: /cvs/ports/audio/hgd/Makefile,v retrieving revision 1.5 diff -u -p -u -r1.5 Makefile --- Makefile 25 Jul 2011 23:07:49 -0000 1.5 +++ Makefile 6 Sep 2011 00:07:37 -0000 @@ -2,6 +2,7 @@ COMMENT = music system for hackathons DISTNAME = hgd-0.4.1 +REVISION = 0 CATEGORIES = audio net HOMEPAGE = https://github.com/vext01/hgd/ Index: patches/patch-hgd-netd_c =================================================================== RCS file: patches/patch-hgd-netd_c diff -N patches/patch-hgd-netd_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-hgd-netd_c 6 Sep 2011 00:07:37 -0000 @@ -0,0 +1,34 @@ +$OpenBSD$ + +Fix for #77, seg fault when a client attempts to queue without being logged in. + +--- hgd-netd.c.orig Sun Jul 24 18:29:43 2011 ++++ hgd-netd.c Sat Aug 27 22:51:01 2011 +@@ -303,6 +303,13 @@ hgd_cmd_queue(struct hgd_session *sess, char **args) + ssize_t write_ret; + char *filename, *tag_artist, *tag_title; + ++ if (sess->user == NULL) { ++ hgd_sock_send_line(sess->sock_fd, sess->ssl, ++ "err|user_not_identified"); ++ ret = HGD_FAIL; ++ goto clean; ++ } ++ + if ((flood_limit >= 0) && + (hgd_num_tracks_user(sess->user->name) >= flood_limit)) { + +@@ -320,13 +327,6 @@ hgd_cmd_queue(struct hgd_session *sess, char **args) + if ((bytes == 0) || ((long int) bytes > max_upload_size)) { + DPRINTF(HGD_D_WARN, "Incorrect file size"); + hgd_sock_send_line(sess->sock_fd, sess->ssl, "err|size"); +- ret = HGD_FAIL; +- goto clean; +- } +- +- if (sess->user == NULL) { +- hgd_sock_send_line(sess->sock_fd, sess->ssl, +- "err|user_not_identified"); + ret = HGD_FAIL; + goto clean; + } -- Best Regards Edd Barrett http://www.theunixzoo.co.uk
