fuse_users.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef __FUSE_USERS_H__
  19. #define __FUSE_USERS_H__
  20. #include <grp.h>
  21. #include <pwd.h>
  22. #include <pthread.h>
  23. /**
  24. * Overall Note:
  25. * 1. all these functions should be thread safe.
  26. * 2. the ones that return char * or char **, generally require
  27. * the caller to free the return value.
  28. *
  29. */
  30. /**
  31. * Utility for getting the user making the fuse call in char * form
  32. * NOTE: if non-null return, the return must be freed by the caller.
  33. */
  34. char *getUsername(uid_t uid);
  35. /**
  36. * Cleans up a char ** group pointer
  37. */
  38. void freeGroups(char **groups, int numgroups);
  39. /**
  40. * Lookup single group. Caller responsible for free of the return value
  41. */
  42. char *getGroup(gid_t gid);
  43. /**
  44. * Utility for getting the group from the uid
  45. * NOTE: if non-null return, the return must be freed by the caller.
  46. */
  47. char *getGroupUid(uid_t uid) ;
  48. /**
  49. * lookup the gid based on the uid
  50. */
  51. gid_t getGidUid(uid_t uid);
  52. /**
  53. * Utility for getting the groups for the user making the fuse call in char * form
  54. */
  55. char ** getGroups(uid_t uid, int *num_groups);
  56. #endif