af_protect(3)

πŸ’– af_protect β€” NAME πŸ’–

ok so bestie, this is the AtFS protection-handling trio: af_chowner, af_chauthor, and af_chmod. they're your lil gatekeepers for who owns what and who's allowed to touch it ✨ (the manual page itself lives under af_protect(3), in case you were wondering, and the whole thing belongs to the Attribute Filesystem (AtFS) πŸŽ€)


🌸 SYNOPSIS 🌸

#include <atfs.h>

int af_chowner (Af_key *aso, Af_user *owner)

int af_chauthor (Af_key *aso, Af_user *author)

int af_chmod (Af_key *aso, int mode)

✨ DESCRIPTION ✨

okay so here's the tea πŸ“ β€” af_chowner and af_chauthor are the two functions that go in and modify the owner and author attribute of an ASO. simple as that, no cap.

but!! and this is the important part β€” only the superuser is allowed to change the owner of an object history πŸ‘‘. like, that's a root-only move, bestie.

and the author attribute of an ASO? that one can only be changed by its owner. so if it's not yours, hands off πŸ™ˆ.

the Af_user structure has this form, exactly:

typedef struct {
     char af_username[MAXUSERNAMELEN];
     char af_userhost[MAXHOSTNAMELEN];
     char af_userdomain[MAXDOMAIN+1];
     } Af_user;

meanwhile af_chmod changes the mode of an ASO πŸ’…. for the full deets on that, go peek at chmod(3) β€” it's giving very much "same energy, different function."


πŸ¦‹ SEE ALSO πŸ¦‹

  • chown (2)
  • chmod (2)

πŸ’€ DIAGNOSTICS πŸ’€

if something goes wrong, -1 gets returned and af_errno is set to the corresponding error number. so like, always check it, okay? don't just vibe past the return value 😭


🚨 BUGS 🚨

af_chowner does not work.

yeah. it just… doesn't. iconic of it honestly πŸ’€ not me finding this in the manual and it being right there. anyway, that's the whole warning, fr fr.


AtFS-1.71 🫢 Fri Jun 25 14:33:16 1993 β€” that's the version and date this page was born, and that's your cute lil sign-off, bestie πŸŒˆπŸ’– go forth and protect your ASOs ✨

πŸ“¦ where this page comes from