Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 May 2023 12:25:40 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 271704] O_PATH and acl_get_fd_np doesn't work on FreeBSD 13(.2) and causes vfs_zfsacl in Samba to fail
Message-ID:  <bug-271704-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271704

            Bug ID: 271704
           Summary: O_PATH and acl_get_fd_np doesn't work on FreeBSD
                    13(.2) and causes vfs_zfsacl in Samba to fail
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: pen@lysator.liu.se

The new O_PATH support in FreeBSD 13 doesn't seem to work with trying to re=
ad
ZFS ACLs via acl_get_fd_np().

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/acl.h>
#include <sys/stat.h>


int
main(int argc,
     char *argv[]) {
  int i, j, fd;
  acl_t a;
  char *path =3D ".";
  int flags =3D O_PATH;
  struct stat sb;


  for (i =3D 1; i < argc && argv[i][0] =3D=3D '-'; i++) {
    for (j =3D 1; argv[i][j]; j++) {
      switch (argv[i][j]) {
      case 'n':
        flags =3D 0;
        break;
      }
    }
  }

  if (i < argc)
    path =3D argv[i];

  fd =3D open(path, O_RDONLY|flags);
  if (fd < 0) {
    fprintf(stderr, "%s: Error: %s: open: %s\n", argv[0], path,
strerror(errno));
    exit(1);
  }

  if (fstat(fd, &sb) < 0) {
    fprintf(stderr, "%s: Error: %s: fstat: %s\n", argv[0], path,
strerror(errno));
  }

  a =3D acl_get_fd_np(fd, ACL_TYPE_NFS4);
  if (!a) {
    fprintf(stderr, "%s: Error: %s: acl_get_fd_np: %s\n", argv[0], path,
strerror(errno));
  }

  return 0;
}


root@runur00:~Lpeter86 # ./t=20
./t: Error: .: acl_get_fd_np: Bad file descriptor

root@runur00:~Lpeter86 # ./t -n

root@runur00:~Lpeter86 # getfacl .
# file: .
# owner: Lpeter86
# group: Ladmins
            owner@:rwxp--aARWcCos:-------:allow
            group@:------a-R-c--s:-------:allow
         everyone@:------a-R-c--s:-------:allow



This seems to cause atleast the Samba "zfsacl" module to fail.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271704-227>