Repository: privacyidea/privacyidea

Issue:
API failures in machine/authitem/ssh
### Top-level intent
Tried to query all SSH pubkeys via API `/machine/authitem/ssh`. The command returned flawlessly on the test machine, while failing on our production machines.

### Steps to reproduce
1. Query `http GET https://${mfa_host}/machine/authitem/ssh realm=${mfa_realm} authorization:${mfa_authtok} hostname=${mfa_retrievalhost}`
2. Obtain error message for one server, while obtaining expected results for another
   ```
   HTTP/1.1 500 INTERNAL SERVER ERROR
   Cache-Control: no-cache
   Connection: keep-alive
   Content-Length: 897
   Content-Type: application/json
   Date: Mon, 14 Nov 2022 10:59:45 GMT
   Server: nginx/1.19.8
   
   {
       "detail": null,
       "id": 1,
       "jsonrpc": "2.0",
       "result": {
           "error": {
               "code": -500,
               "message": "500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."
           },
           "status": false
       },
       "signature": "rsa_sha256_pss:a06a84160ae31d4a481866fb664caf751e5636a0dcbd2879084c88ee1c77c591d714efc0f3fd7cbf84d20fc1c52c618d4a0c02034c35e3861e551e3a47aa094d3e91d12ab772c080b5295bda5292eba3b834407d75e279bb33624f7aa891d62451f839c056a3117414d2a870b0288cf02fbe7ecc5a2d9c185674ed63d20a2a3db6cf05a0ac1029a9b7a6156447159b7cb60cbb29385106ffe203b56e0dc51d6a4d2e04acadab79a0eab376ced63ff800d2dd16aa84ca78f7445ec5a9983e247c0e90ce7e26fa042a960ce12b1dad2ed53802ad576d6c0f4c78abcdb494a9f1137d8c08d2fccf36c4cda76bcacff8b9849129b8fc84c06e20d0fbbeac4b7ecd93",
       "time": 1668423585.4647074,
       "version": "privacyIDEA 3.7.3"
   }
   ```
3. Check server logs on impacted server, see stack trace and
   ```
   ldap3.core.exceptions.LDAPInvalidValueError: value 'None' non valid for attribute 'entryUUID'
   ```

### Expected outcome
API should have returned all SSH pubkeys matching the query conditions.

### Actual outcome
`ldap3.core.exceptions.LDAPInvalidValueError: value 'None' non valid for attribute 'entryUUID'`

### Configuration

* **privacyIDEA version**: 3.7.3
* **Installation method**: pip
* **Python version**: 3.6
* **Operating system**: SLES15
* **Webserver**: Nginx+UWSGI
* **Token database**: MySQL/Galera cluster

### Log file

**Set PI_LOGLEVEL = logging.DEBUG in pi.cfg and take a look at the privacyidea.log!**
**If appropriate, attach the log file or paste relevant portions.**

```
Nov 14 10:37:18 idp-mfa-prod1 uwsgi[16600]: INFO:privacyidea.lib.resolvers.LDAPIdResolver:Setting system wide POOLING_LOOP_TIMEOUT to 10.
Nov 14 10:37:20 idp-mfa-prod1 uwsgi[16600]: INFO:privacyidea.lib.resolvers.LDAPIdResolver:Setting system wide POOLING_LOOP_TIMEOUT to 10.
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: ERROR:privacyidea.app:Exception on /machine/authitem/ssh [GET]
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: Traceback (most recent call last):
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     response = self.full_dispatch_request()
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     rv = self.handle_user_exception(e)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     reraise(exc_type, exc_value, tb)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     raise value
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     rv = self.dispatch_request()
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return self.view_functions[rule.endpoint](**req.view_args)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/api/lib/prepolicy.py", line 155, in policy_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return wrapped_function(*args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/api/lib/prepolicy.py", line 155, in policy_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return wrapped_function(*args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/api/machine.py", line 372, in get_auth_items_api
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     filter_param=filter_param)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/machine.py", line 456, in get_auth_items
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     filter_param=filter_param)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/log.py", line 155, in log_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return func(*args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/applications/base.py", line 127, in get_auth_item
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     filter_param=filter_param)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/applications/ssh.py", line 79, in get_authentication_item
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     uInfo = user_object.info
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/user.py", line 309, in info
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     userInfo = y.getUserInfo(uid)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/resolvers/LDAPIdResolver.py", line 269, in cache_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     f_result = func(self, *args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/resolvers/LDAPIdResolver.py", line 566, in getUserInfo
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     attributes=list(self.userinfo.values()))
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/core/connection.py", line 843, in search
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     check_names=self.check_names)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/operation/search.py", line 371, in search_operation
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     request['filter'] = compile_filter(parse_filter(search_filter, schema, auto_escape, auto_encode, validator, check_names).elements[0])  # parse the searchFilter string and compile it starting from the root node
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/operation/search.py", line 205, in parse_filter
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     current_node.append(evaluate_match(search_filter[start_pos:end_pos], schema, auto_escape, auto_encode, validator, check_names))
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/operation/search.py", line 165, in evaluate_match
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     assertion = {'attr': left_part, 'value': validate_assertion_value(schema, left_part, right_part, auto_escape, auto_encode, validator, check_names)}
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/protocol/convert.py", line 149, in validate_assertion_value
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     value = validate_attribute_value(schema, name, value, auto_encode, validator=validator, check_names=check_names)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/protocol/convert.py", line 177, in validate_attribute_value
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     raise LDAPInvalidValueError('value \'%s\' non valid for attribute \'%s\'' % (value, name))
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: ldap3.core.exceptions.LDAPInvalidValueError: value 'None' non valid for attribute 'entryUUID'
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: [pid: 16600|app: 0|req: 5990/5990] 127.0.0.1 () {42 vars in 901 bytes} [Mon Nov 14 10:37:17 2022] GET /machine/authitem/ssh => generated 897 bytes in 3961 msecs (HTTP/1.0 500) 3 headers in 116 bytes (1 switches on core 0)
Nov 14 10:39:19 idp-mfa-prod1 uwsgi[16600]: INFO:privacyidea.lib.resolvers.LDAPIdResolver:Setting system wide POOLING_LOOP_TIMEOUT to 10.
```
API failures in machine/authitem/ssh
### Top-level intent
Tried to query all SSH pubkeys via API `/machine/authitem/ssh`. The command returned flawlessly on the test machine, while failing on our production machines.

### Steps to reproduce
1. Query `http GET https://${mfa_host}/machine/authitem/ssh realm=${mfa_realm} authorization:${mfa_authtok} hostname=${mfa_retrievalhost}`
2. Obtain error message for one server, while obtaining expected results for another
   ```
   HTTP/1.1 500 INTERNAL SERVER ERROR
   Cache-Control: no-cache
   Connection: keep-alive
   Content-Length: 897
   Content-Type: application/json
   Date: Mon, 14 Nov 2022 10:59:45 GMT
   Server: nginx/1.19.8
   
   {
       "detail": null,
       "id": 1,
       "jsonrpc": "2.0",
       "result": {
           "error": {
               "code": -500,
               "message": "500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."
           },
           "status": false
       },
       "signature": "rsa_sha256_pss:a06a84160ae31d4a481866fb664caf751e5636a0dcbd2879084c88ee1c77c591d714efc0f3fd7cbf84d20fc1c52c618d4a0c02034c35e3861e551e3a47aa094d3e91d12ab772c080b5295bda5292eba3b834407d75e279bb33624f7aa891d62451f839c056a3117414d2a870b0288cf02fbe7ecc5a2d9c185674ed63d20a2a3db6cf05a0ac1029a9b7a6156447159b7cb60cbb29385106ffe203b56e0dc51d6a4d2e04acadab79a0eab376ced63ff800d2dd16aa84ca78f7445ec5a9983e247c0e90ce7e26fa042a960ce12b1dad2ed53802ad576d6c0f4c78abcdb494a9f1137d8c08d2fccf36c4cda76bcacff8b9849129b8fc84c06e20d0fbbeac4b7ecd93",
       "time": 1668423585.4647074,
       "version": "privacyIDEA 3.7.3"
   }
   ```
3. Check server logs on impacted server, see stack trace and
   ```
   ldap3.core.exceptions.LDAPInvalidValueError: value 'None' non valid for attribute 'entryUUID'
   ```

### Expected outcome
API should have returned all SSH pubkeys matching the query conditions.

### Actual outcome
`ldap3.core.exceptions.LDAPInvalidValueError: value 'None' non valid for attribute 'entryUUID'`

### Configuration

* **privacyIDEA version**: 3.7.3
* **Installation method**: pip
* **Python version**: 3.6
* **Operating system**: SLES15
* **Webserver**: Nginx+UWSGI
* **Token database**: MySQL/Galera cluster

### Log file

**Set PI_LOGLEVEL = logging.DEBUG in pi.cfg and take a look at the privacyidea.log!**
**If appropriate, attach the log file or paste relevant portions.**

```
Nov 14 10:37:18 idp-mfa-prod1 uwsgi[16600]: INFO:privacyidea.lib.resolvers.LDAPIdResolver:Setting system wide POOLING_LOOP_TIMEOUT to 10.
Nov 14 10:37:20 idp-mfa-prod1 uwsgi[16600]: INFO:privacyidea.lib.resolvers.LDAPIdResolver:Setting system wide POOLING_LOOP_TIMEOUT to 10.
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: ERROR:privacyidea.app:Exception on /machine/authitem/ssh [GET]
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: Traceback (most recent call last):
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     response = self.full_dispatch_request()
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     rv = self.handle_user_exception(e)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     reraise(exc_type, exc_value, tb)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     raise value
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     rv = self.dispatch_request()
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return self.view_functions[rule.endpoint](**req.view_args)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/api/lib/prepolicy.py", line 155, in policy_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return wrapped_function(*args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/api/lib/prepolicy.py", line 155, in policy_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return wrapped_function(*args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/api/machine.py", line 372, in get_auth_items_api
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     filter_param=filter_param)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/machine.py", line 456, in get_auth_items
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     filter_param=filter_param)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/log.py", line 155, in log_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     return func(*args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/applications/base.py", line 127, in get_auth_item
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     filter_param=filter_param)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/applications/ssh.py", line 79, in get_authentication_item
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     uInfo = user_object.info
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/user.py", line 309, in info
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     userInfo = y.getUserInfo(uid)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/resolvers/LDAPIdResolver.py", line 269, in cache_wrapper
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     f_result = func(self, *args, **kwds)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/privacyidea/lib/resolvers/LDAPIdResolver.py", line 566, in getUserInfo
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     attributes=list(self.userinfo.values()))
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/core/connection.py", line 843, in search
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     check_names=self.check_names)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/operation/search.py", line 371, in search_operation
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     request['filter'] = compile_filter(parse_filter(search_filter, schema, auto_escape, auto_encode, validator, check_names).elements[0])  # parse the searchFilter string and compile it starting from the root node
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/operation/search.py", line 205, in parse_filter
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     current_node.append(evaluate_match(search_filter[start_pos:end_pos], schema, auto_escape, auto_encode, validator, check_names))
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/operation/search.py", line 165, in evaluate_match
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     assertion = {'attr': left_part, 'value': validate_assertion_value(schema, left_part, right_part, auto_escape, auto_encode, validator, check_names)}
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/protocol/convert.py", line 149, in validate_assertion_value
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     value = validate_attribute_value(schema, name, value, auto_encode, validator=validator, check_names=check_names)
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:   File "/opt/privacyidea/privacyidea-current/lib/python3.6/site-packages/ldap3/protocol/convert.py", line 177, in validate_attribute_value
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]:     raise LDAPInvalidValueError('value \'%s\' non valid for attribute \'%s\'' % (value, name))
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: ldap3.core.exceptions.LDAPInvalidValueError: value 'None' non valid for attribute 'entryUUID'
Nov 14 10:37:21 idp-mfa-prod1 uwsgi[16600]: [pid: 16600|app: 0|req: 5990/5990] 127.0.0.1 () {42 vars in 901 bytes} [Mon Nov 14 10:37:17 2022] GET /machine/authitem/ssh => generated 897 bytes in 3961 msecs (HTTP/1.0 500) 3 headers in 116 bytes (1 switches on core 0)
Nov 14 10:39:19 idp-mfa-prod1 uwsgi[16600]: INFO:privacyidea.lib.resolvers.LDAPIdResolver:Setting system wide POOLING_LOOP_TIMEOUT to 10.
```


Discussion:

Resolving patch:
diff --git a/privacyidea/lib/user.py b/privacyidea/lib/user.py
--- a/privacyidea/lib/user.py
+++ b/privacyidea/lib/user.py
@@ -305,6 +305,8 @@ def info(self):
             # An empty user has no info
             return {}
         (uid, _rtype, _resolver) = self.get_user_identifiers()
+        if uid == None:
+            return {}
         y = get_resolver_object(self.resolver)
         userInfo = y.getUserInfo(uid)
         # Now add the custom attributes, this is used e.g. in ADDUSERINRESPONSE


Test patch: