pastebin - collaborative debugging tool
rovema.kpaste.net RSS


nfsv41: Static userinfo test1
Posted by Anonymous on Thu 14th Sep 2023 09:22
raw | new post
view followups (newest first): msnfs41_client: idmap support with Cygwin getent passwd/group prototype by Anonymous

  1. diff --git a/daemon/idmap.c b/daemon/idmap.c
  2. index 0dfa8ef..9ae7e8c 100644
  3. --- a/daemon/idmap.c
  4. +++ b/daemon/idmap.c
  5. @@ -668,7 +668,7 @@ static int idmap_lookup_user(
  6.          if (time(NULL) - user->last_updated < context->config.cache_ttl)
  7.              goto out;
  8.      }
  9. -
  10. +#if 0
  11.      /* send the query to the ldap server */
  12.      status = idmap_query_attrs(context, lookup,
  13.          attributes, optional, values, NUM_ATTRIBUTES);
  14. @@ -705,7 +705,61 @@ static int idmap_lookup_user(
  15.          goto out_free_values;
  16.      }
  17.      user->last_updated = time(NULL);
  18. -
  19. +#else
  20. +    if (
  21. +        ((lookup->attr == ATTR_USER_NAME) && (!_stricmp(lookup->value, "test001"))) ||
  22. +        ((lookup->attr == ATTR_PRINCIPAL) && (!_stricmp(lookup->value, "test001@GLOBAL.LOC"))) ||
  23. +        ((lookup->attr == ATTR_UID) && (((uid_t)(lookup->value)) == 1000))
  24. +       ) {
  25. +        StringCchCopyA(user->username, VAL_LEN, "test001");
  26. +        StringCchCopyA(user->principal, VAL_LEN, "test001@GLOBAL.LOC");
  27. +        user->uid = 1000;
  28. +        user->gid = 1000;
  29. +       eprintf("# user: test001\n");
  30. +       status = 0;
  31. +    } else if (
  32. +        ((lookup->attr == ATTR_USER_NAME) && (!_stricmp(lookup->value, "root"))) ||
  33. +        ((lookup->attr == ATTR_PRINCIPAL) && (!_stricmp(lookup->value, "root@GLOBAL.LOC"))) ||
  34. +        ((lookup->attr == ATTR_UID) && (((uid_t)(lookup->value)) == 0))
  35. +       ) {
  36. +        StringCchCopyA(user->username, VAL_LEN, "root");
  37. +        StringCchCopyA(user->principal, VAL_LEN, "root@GLOBAL.LOC");
  38. +        user->uid = 0;
  39. +        user->gid = 0;
  40. +       eprintf("# user: root\n");
  41. +       status = 0;
  42. +    } else if (
  43. +        ((lookup->attr == ATTR_USER_NAME) && (!_stricmp(lookup->value, "rmainz"))) ||
  44. +        ((lookup->attr == ATTR_PRINCIPAL) && (!_stricmp(lookup->value, "rmainz@GLOBAL.LOC"))) ||
  45. +        ((lookup->attr == ATTR_UID) && (((uid_t)(lookup->value)) == 1616))
  46. +       ) {
  47. +        StringCchCopyA(user->username, VAL_LEN, "rmainz");
  48. +        StringCchCopyA(user->principal, VAL_LEN, "rmainz@GLOBAL.LOC");
  49. +        user->uid = 1616;
  50. +        user->gid = 1616;
  51. +       eprintf("# user: rmainz\n");
  52. +       status = 0;
  53. +    } else if (
  54. +        ((lookup->attr == ATTR_USER_NAME) && (!_stricmp(lookup->value, "roland_mainz"))) ||
  55. +        ((lookup->attr == ATTR_PRINCIPAL) && (!_stricmp(lookup->value, "roland_mainz@GLOBAL.LOC"))) ||
  56. +        ((lookup->attr == ATTR_UID) && (((uid_t)(lookup->value)) == 197608))
  57. +       ) {
  58. +        StringCchCopyA(user->username, VAL_LEN, "roland_mainz");
  59. +        StringCchCopyA(user->principal, VAL_LEN, "roland_mainz@GLOBAL.LOC");
  60. +        user->uid = 197608;
  61. +        user->gid = 197608;
  62. +       eprintf("# user: roland_mainz\n");
  63. +       status = 0;
  64. +    }
  65. +    else
  66. +    {
  67. +        status = ERROR_NOT_FOUND;
  68. +    }
  69. +    
  70. +    if (status == 0) {
  71. +        user->last_updated = time(NULL);
  72. +    }
  73. +#endif
  74.      if (context->config.cache_ttl) {
  75.          /* insert the entry into the cache */
  76.          cache_insert(&context->users, lookup, &user->entry);
  77. @@ -735,7 +789,7 @@ static int idmap_lookup_group(
  78.          if (time(NULL) - group->last_updated < context->config.cache_ttl)
  79.              goto out;
  80.      }
  81. -
  82. +#if 0
  83.      /* send the query to the ldap server */
  84.      status = idmap_query_attrs(context, lookup,
  85.          attributes, 0, values, NUM_ATTRIBUTES);
  86. @@ -758,7 +812,49 @@ static int idmap_lookup_group(
  87.          goto out_free_values;
  88.      }
  89.      group->last_updated = time(NULL);
  90. +#else
  91. +    if (
  92. +        ((lookup->attr == ATTR_GROUP_NAME) && (!_stricmp(lookup->value, "test001"))) ||
  93. +        ((lookup->attr == ATTR_GID) && (((uid_t)(lookup->value)) == 1000))
  94. +       ) {
  95. +        StringCchCopyA(group->name, VAL_LEN, "test001");
  96. +        group->gid = 1000;
  97. +       eprintf("# group: test001\n");
  98. +       status = 0;
  99. +    } else if (
  100. +        ((lookup->attr == ATTR_GROUP_NAME) && (!_stricmp(lookup->value, "root"))) ||
  101. +        ((lookup->attr == ATTR_GID) && (((uid_t)(lookup->value)) == 0))
  102. +       ) {
  103. +        StringCchCopyA(group->name, VAL_LEN, "root");
  104. +        group->gid = 0;
  105. +       eprintf("# group: root\n");
  106. +       status = 0;
  107. +    } else if (
  108. +        ((lookup->attr == ATTR_GROUP_NAME) && (!_stricmp(lookup->value, "rmainz"))) ||
  109. +        ((lookup->attr == ATTR_GID) && (((uid_t)(lookup->value)) == 1616))
  110. +       ) {
  111. +        StringCchCopyA(group->name, VAL_LEN, "rmainz");
  112. +        group->gid = 1616;
  113. +       eprintf("# group: rmainz\n");
  114. +       status = 0;
  115. +    } else if (
  116. +        ((lookup->attr == ATTR_GROUP_NAME) && (!_stricmp(lookup->value, "Kein"))) ||
  117. +        ((lookup->attr == ATTR_GID) && (((uid_t)(lookup->value)) == 197121))
  118. +       ) {
  119. +        StringCchCopyA(group->name, VAL_LEN, "Kein");
  120. +        group->gid = 197121;
  121. +       eprintf("# group: Kein\n");
  122. +       status = 0;
  123. +    }
  124. +    else
  125. +    {
  126. +        status = ERROR_NOT_FOUND;
  127. +    }
  128.  
  129. +    if (status == 0) {
  130. +        group->last_updated = time(NULL);
  131. +    }
  132. +#endif
  133.      if (context->config.cache_ttl) {
  134.          /* insert the entry into the cache */
  135.          cache_insert(&context->groups, lookup, &group->entry);
  136. @@ -788,6 +884,7 @@ int nfs41_idmap_create(
  137.      cache_init(&context->users, &user_cache_ops);
  138.      cache_init(&context->groups, &group_cache_ops);
  139.  
  140. +#if 0
  141.      /* load ldap configuration from file */
  142.      status = config_init(&context->config);
  143.      if (status) {
  144. @@ -824,6 +921,7 @@ int nfs41_idmap_create(
  145.              goto out_err_free;
  146.          }
  147.      }
  148. +#endif
  149.  
  150.      *context_out = context;
  151.  out:

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