ConfD User Community

Login strips backslash character from input

Hi,
I am working on an issue. In cli, i am entering username as input with backslash.
For example username is ‘user\cli1’
In logs, i see it is getting saved as usercli1.
It removes backslash character.
Is backslash a reserved character in confd or how to solve this issue? Thanks in advance.

When the username is created, you need to type the backslash character twice.

Thanks for the reply. I made change in the code to replace single backslash with double backslash. Here is some info:
XML displayed in shell:
Command: /opt/tailf/confd/bin/confd_load -F p -p "/authentication/edit/local-user-list{local-users}/edit/user

Output:




local-users


user\again


useragain


userrest\a


When wanted to get specific user which is present in above xml:
/opt/tailf/confd/bin/confd_cmd -c “get /authentication/edit/local-user-list{local-users}/edit/user{user\again}/name”
useragain
/opt/tailf/confd/bin/confd_cmd -c “get /authentication/edit/local-user-list{local-users}/edit/user{useragain}/name”
useragain

/opt/tailf/confd/bin/confd_cmd -c “get /authentication/edit/local-user-list{local-users}/edit/user{userrest\a}/name”
FAILED: cdb_get(cs, &val, argv[0]), Error: item does not exist (1): /clp:authentication/edit/local-user-list{local-users}/edit/user{userresta} does not exist, in function do_cdb_get, line 334
[clpdebug@local ~]$ /opt/tailf/confd/bin/confd_cmd -c “get /authentication/edit/local-user-list{local-users}/edit/user{userrest\a}/name”
FAILED: cdb_get(cs, &val, argv[0]), Error: item does not exist (1): /clp:authentication/edit/local-user-list{local-users}/edit/user{userresta} does not exist, in function do_cdb_get, line 334

In the last command, it is double backslash in userrest(double backslash)a

Thanks in adavance.

Using the standard intro/1-2-3 example, following shows how to access usernames with embedded backslash with confd_load and confd_cmd:

1-2-3-start-query-model$ confd_load -F p -p ‘/aaa/authentication/users/user{“test\cli”}’

<config xmlns="http://tail-f.com/ns/config/1.0">
  <aaa xmlns="http://tail-f.com/ns/aaa/1.1">
  <authentication>
  <users>
  <user>
    <name>test\cli</name>
    <uid>23</uid>
    <gid>33</gid>
    <password>$1$sY1nhznB$yplikQbqTYp4qUl5oQWF71</password>
    <ssh_keydir>./</ssh_keydir>
    <homedir>./</homedir>
  </user>
  </users>
  </authentication>
  </aaa>
</config>

1-2-3-start-query-model$ confd_cmd -c ‘get /aaa/authentication/users/user{“test\cli”}/name’

test\cli

Thanks. Greatly appreciate it. Using backslash double helped in cli, but not via REST input.
CLI input double backslash is equivalent to single backslash in REST input xml.
For example:
cli : create user name clidouble\ac
edit user cli
Possible completions:
cliaaa cliaac clidouble\ac

In REST:
input.xml: name start tag: restsingle\ac name end tag

In cli:
edit user restsingle?
This line doesn’t have a valid range expression
Possible completions:
restsingle\ac

You can put double quotes around the string in cli instead of the double backslashes.