Menu

#53 vmoduser options

closed
None
9
2009-04-02
2008-04-22
Steven
No

Suggested additional flags for vmoduser to unset flags without having to clear them all. For example

-p = disable popaccess
-P = enable popaccess (capitalized)

For my current purpose i modified vmoduser.c

Line 84 and Line 110 was:
if ( GidFlag != 0 ) mypw->pw_gid |= GidFlag;
Change to:
if ( GidFlag != 0 ) mypw->pw_gid ^= GidFlag;

the flags now flip. it will set if unset and unset if set. This is good enough for my purpose, but a better solution would be preferable. Basically, the |= is changed to ^=.

Discussion

  • Matt Brookings

    Matt Brookings - 2009-01-14
    • assigned_to: nobody --> volz0r
     
  • Matt Brookings

    Matt Brookings - 2009-01-14

    There's a pair of bug/patch tracker items about this, and I've recommended toggling, but I'm not sure if
    there are systems out there that assume that a flag always sets, and never clears.

    Comments?

     
  • Steven

    Steven - 2009-01-23

    I've modified it further. -p now sets it and +p clears it. getopt doesn't normally support the + operator, but i modify the argv array before giving it to getopt. The reason we want to toggle is that as a host sometimes we want to selectively disable certain functionalities without having it affect others.

     
  • Matt Brookings

    Matt Brookings - 2009-01-23

    Are there systems still where modification of argv is not allowed? The implementation of the +/- operators
    looks good to me if one always sets and one always unsets.

     
  • Tom Collins

    Tom Collins - 2009-01-23

    Toggle is bad -- people may be calling this program from a script set up to automatically disable a service. In that case, if it's already disabled, it should do nothing.

    Adding additional command-line options would be great. If necessary, we could create a new program and revamp the command-line options entirely or use some double-dash options. How about --flags=pSw (disable pop and webmail, enable SMTP)? Wouldn't even need to be the same flags as the other command line options.

    If we still have some digit options (like the USER1, USER2, USER3, USER4 flags?), the upper/lowercase trick doesn't work.

    It's verbose, but "--enable-smtp --disable-pop --enable-webmail --disable-user1" is pretty clear.

     
  • Steven

    Steven - 2009-01-24

    See attachment, it allows the setting and unsetting of all the flags. It makes sure when unsetting something that is already unset remains unset. It uses the same method as above to set / unset flags and modifies argv to allow the use of the + operator. It then translates the + to the corresponding - flag. This patch works for all the flags.
    File Added: vmoduser.c

     
  • Steven

    Steven - 2009-01-24
     
  • Steven

    Steven - 2009-03-10

    I'm not aware of such a system, but they could exist. On the other hand, only administrators would be using these options -p +p and i suppose they should know what they're doing?

     
  • Matt Brookings

    Matt Brookings - 2009-03-14
    • priority: 5 --> 9
     
  • Matt Brookings

    Matt Brookings - 2009-03-14

    As discussed on the list, this will most likely become a new command with full length flag names.

     
  • Matt Brookings

    Matt Brookings - 2009-04-02
    • status: open --> closed
     
  • Matt Brookings

    Matt Brookings - 2009-04-02

    New binary added to 5.5 branch to address this

     

Log in to post a comment.