Changeset - e1fa88daaa57
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-25 01:31:12

Added key-stuff to the register function, needs attention.
1 file changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -16,21 +16,21 @@
 
  You should have received a copy of the GNU Affero General Public License
 
  along with DistRen.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
 /*
 
  * Registration on server. Needs attention. Prevent account spamming.
 
  * TODO: MAKE THIS FUNCTION RETURN THE UNIQUE URL TO THE USER'S KEY!!!
 
  * Set up something like: distrend -c username email@example.com
 
  * distrenslave -c username email@example.com
 
 */
 
void registeruser(char *username, char *email){
 
  /*
 
   * Logs into sandboxed user on zserver2 and registers a user. Should eventually generate a key on the server and return it to the user.
 
   * All created user accounts should be sandboxed accordingly, requiring a different skel, and the default shell to be rbash. Also,
 
   * a custom path defined in the .bash_profile of the skel is needed.
 
  */
 
  char *keyurl; // Url to the key
 
  char buf[10];
 
  struct execio *testrem;
 
  char *execargv[] =
 
    {
 
  "ssh",
 
  "distren_setup@protofusion.org",
 
@@ -42,13 +42,13 @@ void registeruser(char *username, char *
 
  "-M",
 
  "-c",
 
  email,
 
  "-d",
 
  "/home/distren",
 
  "--gid",
 
  "541", // Add in shellscript to generate ssh key and return it to the user somehow, probably post to http
 
  "541", // Add in shellscript to generate ssh key and set keyname
 
  username,
 
  (char *)NULL
 
  };
 
  size_t readlen;
 
  fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv));
 
  buf[9] = '\0'; // null-terminating the array...
 
@@ -58,12 +58,16 @@ void registeruser(char *username, char *
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
    buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is?
 
    fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 

	
 
 exec('exec wget http://protofusion.org/distren/keys/%s',keyname); // Download the key
 
 /* Scan distrenslave.conf for !username and !key and replace them with "keyname" and the "username" */
 

	
 
}
 

	
 

	
 
void loginuser(char *username){
 
  // Logs into sandboxed user on zserver2 as a client, currently does nothing
 
  char buf[10];
0 comments (0 inline, 0 general)