1
0
Эх сурвалжийг харах

* If transfering a userfile, write out an old format

Bryan Drewery 16 жил өмнө
parent
commit
6816bbf7e3

+ 1 - 1
src/mod/share.mod/share.c

@@ -1251,7 +1251,7 @@ write_tmp_userfile(char *fn, const struct userrec *bu, int idx)
   int ok = 1;
 
   if ((f = fopen(fn, "wb"))) {
-    if (real_writeuserfile(idx, bu, f))
+    if (real_writeuserfile(idx, bu, f, 1))
       ok = 0;
     fclose(f);
     fixmod(fn);

+ 2 - 2
src/userrec.c

@@ -527,7 +527,7 @@ int write_userfile(int idx)
 }
 
 /* Used by writeuserfile() and write_tmp_userfile() in share.c */
-int real_writeuserfile(int idx, const struct userrec *bu, FILE *f) {
+int real_writeuserfile(int idx, const struct userrec *bu, FILE *f, bool compat) {
 /* FIXME: REMOVE AFTER 1.2.14 */
   bool old = 0;
 
@@ -538,7 +538,7 @@ int real_writeuserfile(int idx, const struct userrec *bu, FILE *f) {
   const char salt1[] = SALT1;
   EncryptedStream stream(salt1);
   stream_writeuserfile(stream, bu, idx, old);
-  if (stream.writeFile(fileno(f)))
+  if (stream.writeFile(fileno(f)), compat ? ENC_DEFAULT : (ENC_KEEP_NEWLINES|ENC_AES_256_ECB|ENC_BASE64_BROKEN))
     return 1;
   return 0;
 }

+ 1 - 1
src/userrec.h

@@ -17,7 +17,7 @@ int change_handle(struct userrec *, char *);
 void correct_handle(char *);
 void stream_writeuserfile(bd::Stream&, const struct userrec *, int, bool = 0);
 int write_userfile(int);
-int real_writeuserfile(int idx, const struct userrec *bu, FILE *f);
+int real_writeuserfile(int idx, const struct userrec *bu, FILE *f, bool = 0);
 void touch_laston(struct userrec *, char *, time_t);
 void user_del_chan(char *);
 struct userrec *host_conflicts(char *);