# HG changeset patch # User ethanzonca # Date 2009-07-26 18:14:24 # Node ID 9b1f363559ec9c6e9e94607ef3f801ddc35ce0f1 # Parent 01c816bed5664e5e8418a46bc3d101fc30e47dc2 Added pseudo-replacing code diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -100,6 +100,17 @@ void loginuser(char *username){ execio_close(testrem); } +/* Replaces username and key in the slave's conf file, currently pseudo */ +void conf_replace(char *username, char *key){ + // Doesn't delete anything! :D + mktemp(); // Gets a new file to put data into + fopen('w'); // Open the file we created in write mode + fopen('r'); // Open the conf file in read-only mode + read(); // Read the created file, scanning for and replacing strings, whie + writ(); // writing out to the newly created file + fsync(); // fsync the file we wrote data to + rename(); // rename the old file to the new file +} /* Executors */