def ListSuidSgid(path):
  """Finds all the suid/sgid files under path.

  Args:
    path: root of directory tree to examine.
  Returns:
    dictionary of Suid/Sgid files.
  """

  cmd = ['/usr/bin/find', path, '-type', 'f', '(', '-perm', '-004000', '-o',
         '-perm', '-002000', ')', '-exec', 'ls', '-l', '{}', ';']
  res = dmgtestutilities.ProcessCommand(cmd)
  catalog = []
  prefix_length = len(path)
  for f in res['stdout']:
    if f:
      snip = f.find('/')
      if snip:
        snip_index = snip + prefix_length
        rawpath = f[snip_index:]
        catalog.append(rawpath)
      else:
        logging.warn('snip: %s' % snip)
        logging.warn(f)
  return catalog
dataset/ETHPy150Open MacSysadmin/pymacadmin/utilities/diskimage_unittesting/tests/zz_suidguid_test.py/ListSuidSgid/original