Ticket #734: nALFS-1.2.0.patch

File nALFS-1.2.0.patch, 1.8 KB (added by ookaze@…, 21 years ago)

my overall patch for nALFS-1.2.0

  • src/handlers/stage.c

    diff -Naur nALFS-1.2.0-orig/src/handlers/stage.c nALFS-1.2.0/src/handlers/stage.c
    old new  
    113113        }
    114114
    115115        /* getpwnam() is failing in chroot() */
    116         while ((pw = fgetpwent(fp))) {
     116        while ((pw = getpwent())) {
    117117                if (strcmp(pw->pw_name, user) == 0) {
    118118                        break;
    119119                }
  • src/handlers/su.c

    diff -Naur nALFS-1.2.0-orig/src/handlers/su.c nALFS-1.2.0/src/handlers/su.c
    old new  
    108108        }
    109109
    110110        /* getpwnam() is failing in chroot() */
    111         while ((pw = fgetpwent(fp))) {
     111        while ((pw = getpwent())) {
    112112                if (strcmp(pw->pw_name, user) == 0) {
    113113                        break;
    114114                }
  • src/lib/get_url.c

    diff -Naur nALFS-1.2.0-orig/src/lib/get_url.c nALFS-1.2.0/src/lib/get_url.c
    old new  
    4848        int command_status;
    4949        struct stat stat_buf;
    5050        char *temp_file_name;
    51            
     51    const char *template_file = ".nALFS.XXXXXX";
     52    char *buffer = xstrdup(destination);
     53    int temp_file_size = strlen(dirname(buffer)) + 1 + strlen(template_file) + 1; // 1 for / and one for '\0'
    5254
    5355        /* Construct a temporary filename */
    5456
    55         temp_file_name = xstrdup(".nALFS.XXXXXX");
     57    temp_file_name = xmalloc(temp_file_size);
     58    strcat(strcat(strcpy(temp_file_name, buffer), "/"), template_file);
    5659        if (create_temp_file(temp_file_name))
    5760                goto free_all_and_return;
    5861        /* There is a small risk that another user could create a symlink
     
    103106        status = 0;
    104107
    105108 free_all_and_return:
     109    xfree(buffer);
    106110        xfree(temp_file_name);
    107111
    108112        return status;