configuration parsing and loading code for rsyncd. This is based
[rsync/rsync.git] / uidlist.c
index b7d84ce..4aa098f 100644 (file)
--- a/uidlist.c
+++ b/uidlist.c
@@ -256,9 +256,9 @@ void recv_uid_list(int f, struct file_list *flist)
                id = read_int(f);
                while (id != 0) {
                        int len = read_byte(f);
-                       name = (char *)malloc(len);
+                       name = (char *)malloc(len+1);
                        if (!name) out_of_memory("recv_uid_list");
-                       read_buf(f, name, len);
+                       read_sbuf(f, name, len);
                        if (!list) {
                                uidlist = add_list(id, name);
                                list = uidlist;
@@ -279,9 +279,9 @@ void recv_uid_list(int f, struct file_list *flist)
                id = read_int(f);
                while (id != 0) {
                        int len = read_byte(f);
-                       name = (char *)malloc(len);
+                       name = (char *)malloc(len+1);
                        if (!name) out_of_memory("recv_uid_list");
-                       read_buf(f, name, len);
+                       read_sbuf(f, name, len);
                        if (!list) {
                                gidlist = add_list(id, name);
                                list = gidlist;
@@ -300,11 +300,11 @@ void recv_uid_list(int f, struct file_list *flist)
        /* now convert the uid/gid of all files in the list to the mapped
           uid/gid */
        for (i=0;i<flist->count;i++) {
-               if (preserve_uid && flist->files[i].uid != 0) {
-                       flist->files[i].uid = match_uid(flist->files[i].uid);
+               if (preserve_uid && flist->files[i]->uid != 0) {
+                       flist->files[i]->uid = match_uid(flist->files[i]->uid);
                }
-               if (preserve_gid && flist->files[i].gid != 0) {
-                       flist->files[i].gid = match_gid(flist->files[i].gid);
+               if (preserve_gid && flist->files[i]->gid != 0) {
+                       flist->files[i]->gid = match_gid(flist->files[i]->gid);
                }
        }
 }