hfaxd/FileSystem.c++
/*
 * Delete a file (submitted document or received facsimile).
 */
Delete a file (submitted document or received facsimile).
Delete a file ( submitted document or received facsimile ) .
void
HylaFAXServer::deleCmd(const char* pathname)
{
    struct stat sb;
    SpoolDir* dir = fileAccess(pathname, W_OK, sb);
    if (dir) {
	if (!IS(PRIVILEGED)) {
	    if (!S_ISREG(sb.st_mode)) {
		reply(550, "%s: not a plain file.", pathname);
		return;
	    }
	    if (!dir->deleAble) {
		perror_reply(550, pathname, EPERM);
		return;
	    }
	}
	if (Sys::unlink(pathname) < 0)
	    perror_reply(550, pathname, errno);
	else {
	    const char* cp = strrchr(pathname, '/');
	    logNotice("%s of %s [%s] deleted %s%s"
		, (const char*) the_user
		, (const char*) remotehost
		, (const char*) remoteaddr
		, dir->pathname, cp ? cp+1 : pathname
	    );
	    ack(250, cmdToken(T_DELE));
	    FileCache::flush(pathname);
	}
    }
}
void HylaFAXServer :: deleCmd ( const char * pathname ) { struct stat sb ; SpoolDir * dir = fileAccess ( pathname , W_OK , sb ) ; if ( dir ) { if ( ! IS ( PRIVILEGED ) ) { if ( ! S_ISREG ( sb . st_mode ) ) { reply ( 550 , " " , pathname ) ; return ; } if ( ! dir -> deleAble ) { perror_reply ( 550 , pathname , EPERM ) ; return ; } } if ( Sys :: unlink ( pathname ) < 0 ) perror_reply ( 550 , pathname , errno ) ; else { const char * cp = strrchr ( pathname , ' ' ) ; logNotice ( " " , ( const char * ) the_user , ( const char * ) remotehost , ( const char * ) remoteaddr , dir -> pathname , cp ? cp + 1 : pathname ) ; ack ( 250 , cmdToken ( T_DELE ) ) ; FileCache :: flush ( pathname ) ; } } }
Delete a file (submitted document or received facsimile).
Delete a file ( submitted document or received facsimile ) .
/*
	 * XXX must decide what to do with jobs/documents/etc...
	 * XXX e.g. should job be treated like jdele; should we
	 * XXX cross-check document use for consistency....
	 */