logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0007-Disable-uidmap-and-gidmap-support.patch (3372B)


  1. From 71731981d5d726647ca768a643479e7ad757868b Mon Sep 17 00:00:00 2001
  2. From: Michael Forney <mforney@mforney.org>
  3. Date: Sun, 5 Jun 2016 18:24:16 -0700
  4. Subject: [PATCH] Disable uidmap and gidmap support
  5. ---
  6. sshfs.c | 16 ++++++++++++++++
  7. 1 file changed, 16 insertions(+)
  8. diff --git a/sshfs.c b/sshfs.c
  9. index 42ff750..472f98c 100644
  10. --- a/sshfs.c
  11. +++ b/sshfs.c
  12. @@ -248,10 +248,12 @@ struct sshfs {
  13. char *mountpoint;
  14. char *uid_file;
  15. char *gid_file;
  16. +#if 0
  17. GHashTable *uid_map;
  18. GHashTable *gid_map;
  19. GHashTable *r_uid_map;
  20. GHashTable *r_gid_map;
  21. +#endif
  22. unsigned max_read;
  23. unsigned max_write;
  24. unsigned ssh_ver;
  25. @@ -384,7 +386,9 @@ enum {
  26. enum {
  27. IDMAP_NONE,
  28. IDMAP_USER,
  29. +#if 0
  30. IDMAP_FILE,
  31. +#endif
  32. };
  33. enum {
  34. @@ -405,7 +409,9 @@ static struct fuse_opt sshfs_opts[] = {
  35. SSHFS_OPT("workaround=%s", workarounds, 0),
  36. SSHFS_OPT("idmap=none", idmap, IDMAP_NONE),
  37. SSHFS_OPT("idmap=user", idmap, IDMAP_USER),
  38. +#if 0
  39. SSHFS_OPT("idmap=file", idmap, IDMAP_FILE),
  40. +#endif
  41. SSHFS_OPT("uidfile=%s", uid_file, 0),
  42. SSHFS_OPT("gidfile=%s", gid_file, 0),
  43. SSHFS_OPT("nomap=ignore", nomap, NOMAP_IGNORE),
  44. @@ -554,6 +560,7 @@ static int list_empty(const struct list_head *head)
  45. return head->next == head;
  46. }
  47. +#if 0
  48. /* given a pointer to the uid/gid, and the mapping table, remap the
  49. * uid/gid, if necessary */
  50. static inline int translate_id(uint32_t *id, GHashTable *map)
  51. @@ -571,6 +578,7 @@ static inline int translate_id(uint32_t *id, GHashTable *map)
  52. abort();
  53. }
  54. }
  55. +#endif
  56. static inline void buf_init(struct buffer *buf, size_t size)
  57. {
  58. @@ -813,12 +821,14 @@ static int buf_get_attrs(struct buffer *buf, struct stat *stbuf, int *flagsp)
  59. if (gid == sshfs.remote_gid)
  60. gid = sshfs.local_gid;
  61. }
  62. +#if 0
  63. if (sshfs.idmap == IDMAP_FILE && sshfs.uid_map)
  64. if (translate_id(&uid, sshfs.uid_map) == -1)
  65. return -EPERM;
  66. if (sshfs.idmap == IDMAP_FILE && sshfs.gid_map)
  67. if (translate_id(&gid, sshfs.gid_map) == -1)
  68. return -EPERM;
  69. +#endif
  70. memset(stbuf, 0, sizeof(struct stat));
  71. stbuf->st_mode = mode;
  72. @@ -2473,12 +2483,14 @@ static int sshfs_chown(const char *path, uid_t uid, gid_t gid,
  73. if (gid == sshfs.local_gid)
  74. gid = sshfs.remote_gid;
  75. }
  76. +#if 0
  77. if (sshfs.idmap == IDMAP_FILE && sshfs.r_uid_map)
  78. if(translate_id(&uid, sshfs.r_uid_map) == -1)
  79. return -EPERM;
  80. if (sshfs.idmap == IDMAP_FILE && sshfs.r_gid_map)
  81. if (translate_id(&gid, sshfs.r_gid_map) == -1)
  82. return -EPERM;
  83. +#endif
  84. buf_init(&buf, 0);
  85. if (sf == NULL)
  86. @@ -3782,6 +3794,7 @@ static int ssh_connect(void)
  87. return 0;
  88. }
  89. +#if 0
  90. /* number of ':' separated fields in a passwd/group file that we care
  91. * about */
  92. #define IDMAP_FIELDS 3
  93. @@ -3956,6 +3969,7 @@ static inline void load_gid_map(void)
  94. {
  95. read_id_map(sshfs.gid_file, &groupname_to_gid, "gid", &sshfs.gid_map, &sshfs.r_gid_map);
  96. }
  97. +#endif
  98. #ifdef __APPLE__
  99. int main(int argc, char *argv[], __unused char *envp[], char **exec_path)
  100. @@ -4052,6 +4066,7 @@ int main(int argc, char *argv[])
  101. if (sshfs.idmap == IDMAP_USER)
  102. sshfs.detect_uid = 1;
  103. +#if 0
  104. else if (sshfs.idmap == IDMAP_FILE) {
  105. sshfs.uid_map = NULL;
  106. sshfs.gid_map = NULL;
  107. @@ -4066,6 +4081,7 @@ int main(int argc, char *argv[])
  108. if (sshfs.gid_file)
  109. load_gid_map();
  110. }
  111. +#endif
  112. free(sshfs.uid_file);
  113. free(sshfs.gid_file);
  114. --
  115. 2.24.0