Commit 5dd3ee55 authored by Seblu's avatar Seblu
Browse files

Correction bug sur md5

parent e174cb05
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -6,4 +6,3 @@ command reload
command update

BUG:
la commande file est buggé suremetn dans le MD5
+6 −7
Original line number Diff line number Diff line
@@ -436,9 +436,9 @@ void SLDaemon::cmd_file(const char *line) {
  }
  
  //get md5
  char *md5;  
  char md5[512]; //FIXME: bad magic size
  buf = recvln();
  ret = sscanf(buf, "MD5 %s\n", md5);
  ret = sscanf(buf, "MD5 %512s\n", md5);
  delete buf;
  if (ret != 1) {
    tee("Invalid md5 parameter.");
@@ -466,23 +466,22 @@ void SLDaemon::cmd_file(const char *line) {
  }

  // check MD5
  std::cout << SLDaemon::md5(target) <<std::endl;;
  if (SLDaemon::md5(target) != string(md5)) {
    tee("Transfer of " + target + ": FAILED.");
    tee("Transfer of " + target + ": Invalid MD5.");
    unlink(target.c_str());
    return;
 }

  // proceed chown
  if (chown(target.c_str(), getuid(), getgid())) {
    tee("chown of " + target + ": FAILED.");
    tee("chown of " + target + ": Unable to chown.");
    unlink(target.c_str());
    return;
  }

  // proceed chmod
  if (chmod(target.c_str(), S_IRUSR | S_IWUSR | S_IXUSR)) {
    tee("chmod of " + target + ": FAILED.");
    tee("chmod of " + target + ": Unable to chmod.");
    unlink(target.c_str());
    return;
  }
+3 −0
Original line number Diff line number Diff line
@@ -73,6 +73,9 @@ protected:
  int socket_fd_;
  FILE* socket_fs_;

  // pid list
  std::set<int> jobs;

  // Options functions
  void usage(const char *argv0) const;
  void check_options() const;