+static void rpc_set_uid_gid(struct rpc_context *rpc, int uid, int gid) {
+ if (uid != rpc->uid || gid != rpc->gid) {
+ struct AUTH *auth = libnfs_authunix_create("libnfs", uid, gid, 0, NULL);
+ if (auth != NULL) {
+ rpc_set_auth(rpc, auth);
+ rpc->uid = uid;
+ rpc->gid = gid;
+ }
+ }
+}
+
+void rpc_set_uid(struct rpc_context *rpc, int uid) {
+ rpc_set_uid_gid(rpc, uid, rpc->gid);
+}
+
+void rpc_set_gid(struct rpc_context *rpc, int gid) {
+ rpc_set_uid_gid(rpc, rpc->uid, gid);
+}