Re: [Proftpd-user] ftpasswd --group question
Ian via Proftp-user <[email protected]>
| Newsgroups | gmane.network.proftpd.user |
|---|---|
| Message-ID | <[email protected]> |
Hey TJ
i took a look at the new code in the master branch . Is the intention of the new fix (--add-member) to allow adding new members to "EXISTING members ftpd.group" ? or just to make it work with existing --member option?
it looks like the code will still override all existing values in the ftpd.group
| sub handle_group_entry { |
| | my %args = @_; |
| | |
| | my $gid = $args{'gid'}; |
| | my $name = $args{'name'}; |
| | my $delete_group = $args{'delete_group'}; |
| | my $delete_user = $args{'delete_user'}; |
| | my $add_user = $args{'add_user'}; # this comes from the --add-member option |
| | my $passwd; |
| | # -- next 2 lines handles the -m or --member options |
| | my $members = ""; |
| | $members = join(',', @{$args{'members'}}) if (defined($args{'members'})); |
| | |
| | # check to see whether we should update the fields for this group (because |
| | # it already exists), or to create a new entry |
| | |
| | my $found = 0; |
| | my $index = 0; |
| | for ($index = 0; $index <= $#data; $index++) { |
| | my @entry = split(':', $data[$index]); |
| | |
| | if ($name eq $entry[0]) { |
| | $found = 1; |
| | |
| | # If we have not been given an explicit password, reuse the existing one. |
| | $passwd = $entry[2] unless $passwd; |
| | |
| | # If we have not been given an explicit GID, reuse the existing one. |
| | $gid = $entry[2] unless $gid;
# should there be some code here to append the new values from the ARGS to existing members , i.e. # but should also remove any dups. members += $entry[3];
|
| | |
| | last; |
| | } |
| | } |
From: TJ Saunders <[email protected]>
To: Ian <[email protected]>; [email protected]
Sent: Tuesday, October 31, 2017 8:24 PM
Subject: Re: [Proftpd-user] ftpasswd --group question
> Thanks for the quick response. I have another related question. I am
> assuming that a group can contain multiple users.
Yes.
> Executing the 2 commands in succession
> ftpasswd --group --file /sftp-config/proftpd.group --name business_users
> --gid 1200 --member john ftpasswd --group --file
> /sftp-config/proftpd.group --name business_users --gid 1200 --member
> mary
>
>
> should be identical to
> ftpasswd --group --file /sftp-config/proftpd.group --name business_users
> --gid 1200 --member john --member mary
>
>
> But it looks like using the first method, the 2nd command will overwrite
> the first entry in group file. In the above case, john was added to the
> group file and then marry overwrites his entry.
Unfortunately yes, ftpasswd, used as above, does not *add* the new
member, but rathers *sets* the members of the existing group to just the
list of members specified. I've filed another ticket to handle this use
case (adding a new member to an existing group):
https://github.com/proftpd/proftpd/issues/625
Cheers,
TJ
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ProFTPD Users List <[email protected]>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html