RE: Does sendfile() copy extended attributes?

Joseph D. Wagner
2003-12-20T12:19:27Z

> just out of curiosity:
> why not using rsync(1) or cp -a ??

Because that violates one of the Immutable Laws of Security -- "If you're running someone else's program, it's not your program anymore."

If my program executes another program like cp/rsync in your example, it would be vulnerable to a privilege elevation when run as root. A hacker could replace cp/rsync, change the PATH, or a dozen other tricks to get it to execute his version of cp/rsync.

Now if there's a function call that will copy a file -- other than the sendfile function which is what this thread has been all about -- I'm all ears. However, I am not going to execute another program.

Joseph D. Wagner