Browse code

handle failure of getgrgid_grpname() and getpwuid_username()

If these throw a TypeError (not sure how to cause it, but had one
report of same), we would die. So catch that too.

Matt Domsch authored on 2014/04/13 10:40:16
Showing 1 changed files
... ...
@@ -1154,7 +1154,7 @@ def _build_attr_header(local_list, src):
1154 1154
         if attr == 'uname':
1155 1155
             try:
1156 1156
                 val = Utils.getpwuid_username(local_list[src]['uid'])
1157
-            except KeyError:
1157
+            except (KeyError, TypeError):
1158 1158
                 attr = "uid"
1159 1159
                 val = local_list[src].get('uid')
1160 1160
                 if val:
... ...
@@ -1162,7 +1162,7 @@ def _build_attr_header(local_list, src):
1162 1162
         elif attr == 'gname':
1163 1163
             try:
1164 1164
                 val = Utils.getgrgid_grpname(local_list[src].get('gid'))
1165
-            except KeyError:
1165
+            except (KeyError, TypeError):
1166 1166
                 attr = "gid"
1167 1167
                 val = local_list[src].get('gid')
1168 1168
                 if val: