diff --git a/ChangeLog b/ChangeLog index 62d760f..b8b2074 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -* SVN +* 0.5.0 +- --add-device doesn't require a device name anymore. The + name is instead generated from the device signature. +- Added deny_remote option (defaults to true). If false, + local login check will be disabled. - Fixed a bug in the device recognition (--add-device) * 0.4.2 diff --git a/src/conf.c b/src/conf.c index f349a84..70d7837 100644 --- a/src/conf.c +++ b/src/conf.c @@ -48,6 +48,8 @@ static void pusb_conf_options_get_from(t_pusb_options *opts, &(opts->pad_expiration)); pusb_xpath_get_time_from(doc, from, "option[@name='probe_timeout']", &(opts->probe_timeout)); + pusb_xpath_get_bool_from(doc, from, "option[@name='deny_remote']", + &(opts->deny_remote)); } static int pusb_conf_parse_options(t_pusb_options *opts, @@ -145,6 +147,7 @@ int pusb_conf_init(t_pusb_options *opts) opts->color_log = 1; opts->one_time_pad = 1; opts->pad_expiration = 3600; + opts->deny_remote = 1; return (1); } diff --git a/src/conf.h b/src/conf.h index 9c635c2..07a8810 100644 --- a/src/conf.h +++ b/src/conf.h @@ -31,7 +31,7 @@ typedef struct pusb_device { - char name[32]; + char name[128]; char vendor[128]; char model[128]; char serial[128]; @@ -47,6 +47,7 @@ typedef struct pusb_options int color_log; int one_time_pad; time_t pad_expiration; + int deny_remote; char hostname[64]; char system_pad_directory[PATH_MAX]; char device_pad_directory[PATH_MAX]; diff --git a/src/local.c b/src/local.c index 42bc2d1..8f3ce8d 100644 --- a/src/local.c +++ b/src/local.c @@ -29,6 +29,11 @@ int pusb_local_login(t_pusb_options *opts, const char *user) const char *from; int i; + if (!opts->deny_remote) + { + log_debug("deny_remote is disabled. Skipping local check.\n"); + return (1); + } log_debug("Checking whether the caller is local or not...\n"); from = ttyname(STDIN_FILENO); if (!from || !(*from)) diff --git a/src/xpath.c b/src/xpath.c index 27b88c8..a1388b8 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -68,7 +68,10 @@ static int pusb_xpath_strip_string(char *dest, const char *src, return (0); if ((last_char - first_char) > (size - 1)) + { + log_error("Device name is too long: %s", src); return (0); + } memset(dest, 0x0, size); strncpy(dest, &(src[first_char]), last_char - first_char + 1);