Browse Source

Added deny_remote option

master
aluzzardi 13 years ago
parent
commit
de5be5d58c
5 changed files with 18 additions and 2 deletions
  1. +5
    -1
      ChangeLog
  2. +3
    -0
      src/conf.c
  3. +2
    -1
      src/conf.h
  4. +5
    -0
      src/local.c
  5. +3
    -0
      src/xpath.c

+ 5
- 1
ChangeLog View File

@ -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) - Fixed a bug in the device recognition (--add-device)
* 0.4.2 * 0.4.2


+ 3
- 0
src/conf.c View File

@ -48,6 +48,8 @@ static void pusb_conf_options_get_from(t_pusb_options *opts,
&(opts->pad_expiration)); &(opts->pad_expiration));
pusb_xpath_get_time_from(doc, from, "option[@name='probe_timeout']", pusb_xpath_get_time_from(doc, from, "option[@name='probe_timeout']",
&(opts->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, 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->color_log = 1;
opts->one_time_pad = 1; opts->one_time_pad = 1;
opts->pad_expiration = 3600; opts->pad_expiration = 3600;
opts->deny_remote = 1;
return (1); return (1);
} }


+ 2
- 1
src/conf.h View File

@ -31,7 +31,7 @@
typedef struct pusb_device typedef struct pusb_device
{ {
char name[32];
char name[128];
char vendor[128]; char vendor[128];
char model[128]; char model[128];
char serial[128]; char serial[128];
@ -47,6 +47,7 @@ typedef struct pusb_options
int color_log; int color_log;
int one_time_pad; int one_time_pad;
time_t pad_expiration; time_t pad_expiration;
int deny_remote;
char hostname[64]; char hostname[64];
char system_pad_directory[PATH_MAX]; char system_pad_directory[PATH_MAX];
char device_pad_directory[PATH_MAX]; char device_pad_directory[PATH_MAX];


+ 5
- 0
src/local.c View File

@ -29,6 +29,11 @@ int pusb_local_login(t_pusb_options *opts, const char *user)
const char *from; const char *from;
int i; 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"); log_debug("Checking whether the caller is local or not...\n");
from = ttyname(STDIN_FILENO); from = ttyname(STDIN_FILENO);
if (!from || !(*from)) if (!from || !(*from))


+ 3
- 0
src/xpath.c View File

@ -68,7 +68,10 @@ static int pusb_xpath_strip_string(char *dest, const char *src,
return (0); return (0);
if ((last_char - first_char) > (size - 1)) if ((last_char - first_char) > (size - 1))
{
log_error("Device name is too long: %s", src);
return (0); return (0);
}
memset(dest, 0x0, size); memset(dest, 0x0, size);
strncpy(dest, &(src[first_char]), last_char - first_char + 1); strncpy(dest, &(src[first_char]), last_char - first_char + 1);


Loading…
Cancel
Save