pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


chgrp namecache fix prototype
Posted by Anonymous on Tue 20th Feb 2024 06:41
raw | new post

  1. diff --git a/daemon/acl.c b/daemon/acl.c
  2. index deecc38..deea6ab 100644
  3. --- a/daemon/acl.c
  4. +++ b/daemon/acl.c
  5. @@ -578,11 +578,15 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  6.  add_domain:
  7.      memcpy(who_out+size, "@", sizeof(char));
  8.      memcpy(who_out+size+1, domain, strlen(domain)+1);
  9. -    DPRINTF(ACLLVL, ("map_nfs4ace_who: who='%s'\n", who_out));
  10.      if (who) free(who);
  11.      status = ERROR_SUCCESS;
  12.  out:
  13. +    if (status) {
  14.          DPRINTF(ACLLVL, ("<-- map_nfs4ace_who() returns %d\n", status));
  15. +    }
  16. +    else {
  17. +        DPRINTF(ACLLVL, ("<-- map_nfs4ace_who(who_out='%s') returns %d\n", who_out, status));
  18. +    }
  19.      if (sidstr)
  20.          LocalFree(sidstr);
  21.      return status;
  22. @@ -760,12 +764,20 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  23.          OPEN_DELEGATE_WRITE, FALSE);
  24.  
  25.      nfs41_open_stateid_arg(state, &stateid);
  26. +    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  27. +        print_nfs41_file_info("handle_setacl: nfs41_setattr() info IN:", &info);
  28. +    }
  29.      status = nfs41_setattr(state->session, &state->file, &stateid, &info);
  30.      if (status) {
  31.          DPRINTF(ACLLVL, ("handle_setacl: nfs41_setattr() failed with error '%s'.\n",
  32.                  nfs_error_string(status)));
  33.          status = nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
  34.      }
  35. +    else {
  36. +        if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  37. +            print_nfs41_file_info("handle_setacl: nfs41_setattr() success info OUT:", &info);
  38. +        }
  39. +    }
  40.      args->ctime = info.change;
  41.      if (args->query & DACL_SECURITY_INFORMATION)
  42.          free(nfs4_acl.aces);
  43. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  44. index 67b79c3..9941ce2 100644
  45. --- a/daemon/daemon_debug.c
  46. +++ b/daemon/daemon_debug.c
  47. @@ -731,3 +731,74 @@ void print_nfs_access_mask(int on, int m)
  48.      if (m & ACE4_SYNCHRONIZE)
  49.          dprintf_out("\tACE4_SYNCHRONIZE\n");
  50.  }
  51. +
  52. +
  53. +void print_nfs41_file_info(
  54. +    const char *label,
  55. +    const void *vinfo)
  56. +{
  57. +    const nfs41_file_info *info = vinfo;
  58. +    char buf[512];
  59. +    char *p;
  60. +
  61. +    buf[0] = '\0';
  62. +    p = buf;
  63. +
  64. +#define PRNFS41FI_FMT(str, arg) \
  65. +    p += snprintf(p, (sizeof(buf)-(p-buf)), (str), (arg))
  66. +
  67. +    PRNFS41FI_FMT("attrmask.count=%d, ", (int)info->attrmask.count);
  68. +
  69. +    if (info->attrmask.count >= 1) {
  70. +        PRNFS41FI_FMT("{ attrmask.arr[0]=0x%x, ", (int)info->attrmask.arr[0]);
  71. +        if (info->attrmask.arr[0] & FATTR4_WORD0_TYPE)
  72. +            PRNFS41FI_FMT("type=%d, ", (int)(info->type & NFS_FTYPE_MASK));
  73. +        if (info->attrmask.arr[0] & FATTR4_WORD0_CHANGE)
  74. +            PRNFS41FI_FMT("change=%lld, ", (long long)info->change);
  75. +        if (info->attrmask.arr[0] & FATTR4_WORD0_SIZE)
  76. +            PRNFS41FI_FMT("size=%lld, ", (long long)info->size);
  77. +        if (info->attrmask.arr[0] & FATTR4_WORD0_HIDDEN)
  78. +            PRNFS41FI_FMT("hidden=%d, ", (int)info->hidden);
  79. +        if (info->attrmask.arr[0] & FATTR4_WORD0_ARCHIVE)
  80. +            PRNFS41FI_FMT("archive=%d, ", (int)info->archive);
  81. +        p += snprintf(p, (sizeof(buf)-(p-buf)), "} ");
  82. +    }
  83. +    if (info->attrmask.count >= 2) {
  84. +        PRNFS41FI_FMT("{ attrmask.arr[1]=0x%x, ", (int)info->attrmask.arr[1]);
  85. +        if (info->attrmask.arr[1] & FATTR4_WORD1_MODE)
  86. +            PRNFS41FI_FMT("mode=0x%lx, ", (long)info->mode);
  87. +        if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER) {
  88. +            EASSERT(info->owner != NULL);
  89. +            PRNFS41FI_FMT("owner='%s', ", info->owner);
  90. +        }
  91. +        if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
  92. +            EASSERT(info->owner_group != NULL);
  93. +            PRNFS41FI_FMT("owner_group='%s', ", info->owner_group);
  94. +        }
  95. +        if (info->attrmask.arr[1] & FATTR4_WORD1_NUMLINKS)
  96. +            PRNFS41FI_FMT("numlinks=%ld, ", (long)info->numlinks);
  97. +        if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
  98. +            p += snprintf(p, (sizeof(buf)-(p-buf)),
  99. +                "time_access=(%lds/%ldns), ",
  100. +                (long)info->time_access.seconds,
  101. +                (long)info->time_access.nseconds);
  102. +        }
  103. +        if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  104. +            p += snprintf(p, (sizeof(buf)-(p-buf)),
  105. +                "time_create=(%lds/%ldns), ",
  106. +                (long)info->time_create.seconds,
  107. +                (long)info->time_create.nseconds);
  108. +        }
  109. +        if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  110. +            p += snprintf(p, (sizeof(buf)-(p-buf)),
  111. +                "time_modify=(%lds/%ldns), ",
  112. +                (long)info->time_modify.seconds,
  113. +                (long)info->time_modify.nseconds);
  114. +        }
  115. +        if (info->attrmask.arr[1] & FATTR4_WORD1_SYSTEM)
  116. +            PRNFS41FI_FMT("system=%d, ", (int)info->system);
  117. +        p += snprintf(p, (sizeof(buf)-(p-buf)), "} ");
  118. +    }
  119. +
  120. +    dprintf_out("%s={ %s }\n", label, buf);
  121. +}
  122. diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
  123. index 6fa16d7..7f3c9d3 100644
  124. --- a/daemon/daemon_debug.h
  125. +++ b/daemon/daemon_debug.h
  126. @@ -102,6 +102,7 @@ void print_sr_status_flags(int level, int flags);
  127.  void open_log_files();
  128.  void close_log_files();
  129.  const char* secflavorop2name(DWORD sec_flavor);
  130. +void print_nfs41_file_info(const char *label, void *vinfo);
  131.  
  132.  /* pnfs_debug.c */
  133.  enum pnfs_status;
  134. diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
  135. index 50c1809..6676d57 100644
  136. --- a/daemon/nfs41_ops.c
  137. +++ b/daemon/nfs41_ops.c
  138. @@ -1387,6 +1387,31 @@ int nfs41_setattr(
  139.      setattr_args.info = info;
  140.  
  141.      nfs41_superblock_getattr_mask(file->fh.superblock, &attr_request);
  142. +
  143. +    if (info->attrmask.count >= 2) {
  144. +        /*
  145. +         * If we set owner and/or owner_group make sure we ask
  146. +         * the server to send the values back for two reasons:
  147. +         * 1, Handle cases like "all_squash" (e.g. nfsd turns
  148. +         * owner/owner_group always into "nobody"/"nogroup")
  149. +         * 2. Make sure we update the name cache with the new
  150. +         * owner/owner_group
  151. +         *
  152. +         * Note that this can be a bit tricky as we might pass
  153. +         * a "name@domain" string to the server, but get a numeric
  154. +         * uid/gid as strings back, which means the name cache
  155. +         * might have both representations.
  156. +         */
  157. +        if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER) {
  158. +            attr_request.count = 2;
  159. +            attr_request.arr[1] |= FATTR4_WORD1_OWNER;
  160. +        }
  161. +        if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
  162. +            attr_request.count = 2;
  163. +            attr_request.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
  164. +        }
  165. +    }
  166. +
  167.      compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
  168.      getattr_args.attr_request = &attr_request;
  169.      getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at