int diod_remapuser (Npfid *fid, Npstr *uname, u32 n_uname, Npstr *aname) { int ret = 0; if (diod_conf_get_allsquash ()) { char *squash = diod_conf_get_squashuser (); Npuser *user = NULL; if (!(user = np_uname2user (fid->conn->srv, squash))) { ret = -1; goto done; } if (fid->user) np_user_decref (fid->user); fid->user = user; } done: return ret; }
Npuser * np_attach2user (Npsrv *srv, Npstr *uname, u32 n_uname) { Npuser *u = NULL; char *s; if (n_uname != P9_NONUNAME) { u = np_uid2user (srv, n_uname); } else { if (uname->len == 0) { np_uerror (EIO); goto done; } s = np_strdup (uname); if (!s) { np_uerror (ENOMEM); goto done; } u = np_uname2user (srv, s); free (s); } done: return u; }