diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-04-16 13:31:51 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-04-16 13:31:51 +0200 |
commit | a43dcf069684dbdc9897e1364e1ef4165edc3cc9 (patch) | |
tree | 80b456a3d98736a20f6662f1756a5cdc231122de /pgfuse.c | |
parent | 0aeeba0e68291aa9fddc68baef160fc921608c27 (diff) | |
download | pgfuse-a43dcf069684dbdc9897e1364e1ef4165edc3cc9.tar.gz pgfuse-a43dcf069684dbdc9897e1364e1ef4165edc3cc9.tar.bz2 |
added chown (no security checks so far!)
Diffstat (limited to 'pgfuse.c')
-rw-r--r-- | pgfuse.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -820,6 +820,31 @@ static int pgfuse_chmod( const char *path, mode_t mode ) return res; } +static int pgfuse_chown( const char *path, uid_t uid, gid_t gid ) +{ + PgFuseData *data = (PgFuseData *)fuse_get_context( )->private_data; + int id; + PgMeta meta; + int res; + + if( data->verbose ) { + syslog( LOG_INFO, "Chown on '%s' to uid '%d' and gid '%d' on '%s'", + path, (unsigned int)uid, (unsigned int)gid, data->mountpoint ); + } + + id = psql_get_meta( data->conn, path, &meta ); + if( id < 0 ) { + return id; + } + + meta.uid = uid; + meta.gid = gid; + + res = psql_write_meta( data->conn, id, path, meta ); + + return res; +} + static struct fuse_operations pgfuse_oper = { .getattr = pgfuse_getattr, .readlink = NULL, @@ -831,7 +856,7 @@ static struct fuse_operations pgfuse_oper = { .rename = NULL, .link = NULL, .chmod = pgfuse_chmod, - .chown = NULL, + .chown = pgfuse_chown, .utime = NULL, /* deprecated in favour of utimes */ .open = pgfuse_open, .read = pgfuse_read, |