diff --git a/contrib/init.debian b/contrib/init.debian index 5c10bdf..163b7ef 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -35,7 +35,7 @@ WEB_PORT=8080 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS -DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" +DAEMON_OPT="--user $YMPD_USER --mpdpass '$MPD_PASSWORD' --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" do_start() { diff --git a/contrib/ympd.default b/contrib/ympd.default index c7bbcda..e5e7c74 100644 --- a/contrib/ympd.default +++ b/contrib/ympd.default @@ -1,4 +1,5 @@ MPD_HOST=localhost MPD_PORT=6600 +MPD_PASSWORD= WEB_PORT=8080 YMPD_USER=nobody diff --git a/contrib/ympd.service b/contrib/ympd.service index 2289550..023b926 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -5,10 +5,11 @@ Requires=network.target local-fs.target [Service] Environment=MPD_HOST=localhost Environment=MPD_PORT=6600 +Environment=MPD_PASSWORD= Environment=WEB_PORT=8080 Environment=YMPD_USER=nobody EnvironmentFile=/etc/default/ympd -ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT +ExecStart=/usr/bin/ympd --user $YMPD_USER --mpdpass "$MPD_PASSWORD" --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT Type=simple [Install] diff --git a/src/ympd.c b/src/ympd.c index afa25c6..304f5b8 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -87,10 +87,11 @@ int main(int argc, char **argv) {"user", required_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 0 }, + {"mpdpass", required_argument, 0, 'm'}, {0, 0, 0, 0 } }; - while((n = getopt_long(argc, argv, "h:p:w:u:v", + while((n = getopt_long(argc, argv, "h:p:w:u:vm:", long_options, &option_index)) != -1) { switch (n) { case 'h': @@ -105,6 +106,9 @@ int main(int argc, char **argv) case 'u': run_as_user = strdup(optarg); break; + case 'm': + mpd.password = strdup(optarg); + break; case 'v': fprintf(stdout, "ympd %d.%d.%d\n" "Copyright (C) 2014 Andrew Karpow \n" @@ -119,6 +123,7 @@ int main(int argc, char **argv) " -w, --webport [ip:]\tlisten interface/port for webserver [8080]\n" " -u, --user \t\tdrop priviliges to user after socket bind\n" " -V, --version\t\t\tget version\n" + " -m, --mpdpass \tspecifies the password to use when connecting to mpd\n" " --help\t\t\t\tthis help\n" , argv[0]); return EXIT_FAILURE; diff --git a/ympd.1 b/ympd.1 index d94ed30..c8160a6 100644 --- a/ympd.1 +++ b/ympd.1 @@ -23,6 +23,9 @@ specifies the port for the webserver to listen to, defaults to 8080 \fB\-u\fR, \fB\-\-user username\fR drop privileges to the provided username after socket binding .TP +\fB\-m\fR, \fB\-\-mpdpass password\fR +specifies the password to use when connecting to mpd +.TP \fB\-V\fR, \fB\-\-version\fR print version and exit .TP