From 3da9610a06a18e35af092cdf0682dbc49fa96775 Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Tue, 2 Nov 2021 13:03:51 -0400 Subject: [PATCH] updated to check rows returned --- seafile-ldap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seafile-ldap.py b/seafile-ldap.py index 03c03df..d7092a7 100644 --- a/seafile-ldap.py +++ b/seafile-ldap.py @@ -169,8 +169,9 @@ for ldapUser in ldapUsers: query = ("SELECT * FROM LDAPUsers WHERE email = '{0}'".format(ldapUser.mail)) logger.debug("Query: {0}".format(query)) cursor.execute(query) + row_count = cursor.rowcount sqlLDAPuser = cursor.fetchall() - if isinstance(sqlLDAPuser[0], int): + if row_count == 1: # User is in the sql table # are they active is_active = bool(sqlLDAPuser[4])