mathias dufresne
2015-Oct-01 08:02 UTC
[Samba] Fwd: net rpc lookup from group names that start with "-"
Hi Rowland, I'm not good at betting :p I didn't meant to be rough answering that. My point was the same as for the difference between advising to run ./configure or ./configure --help: give users information for they deal with issue themselves. That's why I took time to explain these behaviours, with errors as shown below. Now if it works it's because Samba is well developed, or they - and we, users - are lucky. Most commands don't take backslash in account: $ echo toto > -h $ cat -h cat : option invalide -- 'h' $ cat \-h cat : option invalide -- 'h' $ cat '\-h' cat: \-h: No such file or directory $ cat "\-h" cat: \-h: No such file or directory $ cat -- -h toto Anyway all that shows I was wrong: "\-h" is not interpreted by the shell and the command receives \-h as file name, which is not what I expected. I'm growing old perhaps, I don't take enough time to test, too much trust into my experience, which is always a bad thing. Sorry to have been rude, have a nice day ;) Cheers, mathias 2015-09-30 18:04 GMT+02:00 Rowland Penny <rowlandpenny241155 at gmail.com>:> On 30/09/15 15:59, mathias dufresne wrote: > >> I bet that won't work. >> net rpc ..... "\-dash group" -> the shell look into quotes and interpret >> things inside quotes. Because of double quotes. So the shell will >> interpret >> \- and send only the dash to the command. >> >> net rpc ..... '\-dash group' -> the shell do not interpret things inside >> the quotes, because simple quotes. The shell will send [\-dash group] to >> the command. >> >> This is the same as: >> net rpc ..... "\\-dash group" -> shell interpret \\, transform it into \ >> and send \- to the command. >> >> But the point is command is waiting for switches after dashes (-a -o... >> anything to tell the command how to react). The standard to tell commands >> there is no more switches is double dashes "--". And that double dashes >> must be surrounded by spaces to be one word and be correctly interpreted >> by >> the command. >> >> > Hi Mathias, This got my interest and after I thought 'why would you be > daft enough to start any object name with a dash', I wondered if it was > possible to do what the OP wanted. > I tried to create a group called '-dashtest' and I was able to create it > (after a couple of attempts). I then added a user to the group, I had to > resort to ldbedit to do this. > I then tried the command the OP posted and it didn't work (as expected), > so I tried adding the forwardslash, not really expecting it to work, but it > did. > > Rowland > > > > Rowland > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >
Rowland Penny
2015-Oct-01 08:14 UTC
[Samba] Fwd: net rpc lookup from group names that start with "-"
On 01/10/15 09:02, mathias dufresne wrote:> Hi Rowland, > > I'm not good at betting :p > > I didn't meant to be rough answering that. My point was the same as for the > difference between advising to run ./configure or ./configure --help: give > users information for they deal with issue themselves. That's why I took > time to explain these behaviours, with errors as shown below. > > Now if it works it's because Samba is well developed, or they - and we, > users - are lucky. Most commands don't take backslash in account: > > $ echo toto > -h > $ cat -h > cat : option invalide -- 'h' > $ cat \-h > cat : option invalide -- 'h' > $ cat '\-h' > cat: \-h: No such file or directory > $ cat "\-h" > cat: \-h: No such file or directory > $ cat -- -h > toto > > Anyway all that shows I was wrong: "\-h" is not interpreted by the shell > and the command receives \-h as file name, which is not what I expected. > I'm growing old perhaps, I don't take enough time to test, too much trust > into my experience, which is always a bad thing. > > Sorry to have been rude, have a nice day ;) > > Cheers, > > mathias > > 2015-09-30 18:04 GMT+02:00 Rowland Penny <rowlandpenny241155 at gmail.com>: > >> On 30/09/15 15:59, mathias dufresne wrote: >> >>> I bet that won't work. >>> net rpc ..... "\-dash group" -> the shell look into quotes and interpret >>> things inside quotes. Because of double quotes. So the shell will >>> interpret >>> \- and send only the dash to the command. >>> >>> net rpc ..... '\-dash group' -> the shell do not interpret things inside >>> the quotes, because simple quotes. The shell will send [\-dash group] to >>> the command. >>> >>> This is the same as: >>> net rpc ..... "\\-dash group" -> shell interpret \\, transform it into \ >>> and send \- to the command. >>> >>> But the point is command is waiting for switches after dashes (-a -o... >>> anything to tell the command how to react). The standard to tell commands >>> there is no more switches is double dashes "--". And that double dashes >>> must be surrounded by spaces to be one word and be correctly interpreted >>> by >>> the command. >>> >>> >> Hi Mathias, This got my interest and after I thought 'why would you be >> daft enough to start any object name with a dash', I wondered if it was >> possible to do what the OP wanted. >> I tried to create a group called '-dashtest' and I was able to create it >> (after a couple of attempts). I then added a user to the group, I had to >> resort to ldbedit to do this. >> I then tried the command the OP posted and it didn't work (as expected), >> so I tried adding the forwardslash, not really expecting it to work, but it >> did. >> >> Rowland >> >> >> >> Rowland >> >> -- >> To unsubscribe from this list go to the following URL and read the >> instructions: https://lists.samba.org/mailman/options/samba >>Hi, no I didn't take what you said as rude, after all, I was surprised it worked =-O It just shouldn't work, but does, well it did for me, having said that, the correct cure is for the OP to stop being stupid and to remove the '-' from all and any object names. Rowland