solaris /dev/console patch

Havoc Pennington hp at redhat.com
Tue Apr 25 21:21:50 PDT 2006


Hi,

Artem Kachitchkine wrote:
> +AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[enable console owner file]),enable_console_owner_file=$enableval,enable_console_owner_file=no)
>  

Is there any way to have an "auto" here in addition to yes/no? (most of 
the other options default to "auto" - try to guess - with a force on/off 
also for use by packagers)

Maybe just check for solaris?

> +AC_ARG_WITH(console-auth-owner-file, AS_HELP_STRING([--with-console-owner-file=[filename]],[file to check for console ownerhip]))

Looks like the first arg to this macro should be "console-owner-file"?

The docs might be clearer, "console device which will be chowned to the 
console user" or something, not sure

> +AC_SUBST(DBUS_CONSOLE_AUTH_OWNER_FILE)
> +AC_DEFINE_UNQUOTED(DBUS_CONSOLE_AUTH_OWNER_FILE, "$DBUS_CONSOLE_AUTH_OWNER_FILE", [File to check for console ownerhip])
> +

Here you have the "AUTH" in there, should just be consistent, either way 
is fine

> +#ifdef HAVE_CONSOLE_OWNER_FILE
> +
> +  DBusString f;
> +  DBusStat st;
> +
> +  if (!_dbus_string_init (&f))
> +    {
> +      _DBUS_SET_OOM (error);
> +      return FALSE;
> +    }
> +
> +  if (!_dbus_string_append(&f, DBUS_CONSOLE_AUTH_OWNER_FILE))
> +    {
> +      _dbus_string_free(&f);
> +      _DBUS_SET_OOM (error);
> +      return FALSE;
> +    }
> +
> +  if (_dbus_stat(&f, &st, error) && (st.uid == uid))
> +    {
> +      _dbus_string_free(&f);
> +      return TRUE;
> +    }
> +
> +#endif
> +

Is "f" leaked in the case where /dev/console is not owned?

Also, if the error is set by dbus_stat there it needs to be either 
"thrown" (return false) or freed. You can probably just pass NULL 
instead of passing in error, if you want to ignore this error.

Havoc




More information about the dbus mailing list