Changeset - d131e91f8598
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-30 15:46:53

Commenting
1 file changed with 10 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -28,6 +28,7 @@
 
#include <unistd.h>
 
#include <stdlib.h> /*< malloc(), free() */
 

	
 
/** Generates a SSH key with ssh-keygen */
 
int ssh_keygen(){
 
	// distren.id_rsa and distren.id_rsa.pub are now generated in SYSCONFDIR (etc)
 
	char *command = "ssh-keygen"; // @TODO: append .exe if win32?
 
@@ -47,6 +48,7 @@ int ssh_keygen(){
 
return 0;
 
}
 

	
 
/** Registers the user on the DistRen server */
 
int register_user(char *username, char *email)
 
{
 
  /*
 
@@ -71,19 +73,19 @@ int register_user(char *username, char *
 
      "-d",
 
      "/home/distren",
 
      "--gid",
 
      "541", // Add in shellscript to generate ssh key and set keyname
 
      "541",
 
      username,
 
      (char *)NULL
 
    };
 
  size_t readlen;
 
  fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv));
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff?
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
    {
 
      if(readlen > 9) {
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
      buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is?
 
      buf[readlen] = '\0';
 
      fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 
@@ -96,7 +98,7 @@ int register_user(char *username, char *
 
  return 1;
 
}
 

	
 

	
 
/** Logs the user into the server with a nice ssh session */
 
int login_user(char *username)
 
{
 
  char *userhost;
 
@@ -145,20 +147,19 @@ int login_user(char *username)
 
  }
 
  fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv));
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff?
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
    {
 
      if(readlen > 9) {
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
    buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is?
 
    buf[readlen] = '\0';
 
    fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 
  return 1; // 1 can be like... error-free login...
 
}
 

	
 
/* Replaces username and key in the slave's conf file */
 

	
 
/** Replaces username and key in the slave's conf file */
 
void conf_replace(char *username){
 
  /* Note: SYSCONFDIR doesn't include a trailing slash */
 
  int maxlinelen = 120;
 
@@ -206,6 +207,7 @@ void conf_replace(char *username){
 
  It seems that the client will need to know the job number. fixme.
 
*/
 

	
 
/** Executor function for Blender operations */
 
void exec_blender(struct blendjob* blendjob, char *input, char *output, int frame)
 
{
 
  char *frame_str;
0 comments (0 inline, 0 general)