Changeset 5685
- Timestamp:
- 02/24/10 21:37:16 (3 years ago)
- Location:
- luci2/cbi2
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
luci2/cbi2/luci.uci
r5684 r5685 1 1 config luci luci 2 2 option root /lib/luci2/ 3 option socket /tmp/luci2-socket 233 option socket /tmp/luci2-socket 4 4 option lang en 5 6 config user user 7 # option 'admin' 'admin' 8 option 'admin' '$1$5CpqkCO0$P9BNVRqNTajfArljexEG40' 9 10 config session session -
luci2/cbi2/session.c
r5684 r5685 41 41 session[i] += 'A' - 36; 42 42 } 43 ctx = ucix_init(cbictx, " zepttho", 1);44 ucix_add_option_int(ctx, " zepttho", "session", session, time(0));45 ucix_save(ctx, " zepttho");43 ctx = ucix_init(cbictx, "luci", 1); 44 ucix_add_option_int(ctx, "luci", "session", session, time(0)); 45 ucix_save(ctx, "luci"); 46 46 ucix_cleanup(ctx); 47 47 return session; … … 54 54 if((t > 0) && ((time(0) - t) > session_timeout)) 55 55 { 56 ucix_revert(ctx, " zepttho", "session", key);56 ucix_revert(ctx, "luci", "session", key); 57 57 t = 0; 58 58 } … … 62 62 { 63 63 struct uci_context *ctx; 64 ctx = ucix_init(cbictx, " zepttho", 1);64 ctx = ucix_init(cbictx, "luci", 1); 65 65 uci_set_savedir(ctx, "/var/state/"); 66 ucix_for_each_section_option(ctx, " zepttho", "session", session_expire_cb, ctx);67 ucix_save(ctx, " zepttho");66 ucix_for_each_section_option(ctx, "luci", "session", session_expire_cb, ctx); 67 ucix_save(ctx, "luci"); 68 68 ucix_cleanup(ctx); 69 69 } … … 76 76 if(!auth) 77 77 goto out; 78 ctx = ucix_init(cbictx, " zepttho", 1);78 ctx = ucix_init(cbictx, "luci", 1); 79 79 uci_set_savedir(ctx, "/var/state/"); 80 t = ucix_get_option_int(ctx, " zepttho", "session", auth, 0);80 t = ucix_get_option_int(ctx, "luci", "session", auth, 0); 81 81 if(t) 82 82 { 83 ucix_revert(ctx, " zepttho", "session", auth);84 ucix_add_option_int(ctx, " zepttho", "session", auth, time(0));85 ucix_save(ctx, " zepttho");83 ucix_revert(ctx, "luci", "session", auth); 84 ucix_add_option_int(ctx, "luci", "session", auth, time(0)); 85 ucix_save(ctx, "luci"); 86 86 } 87 87 ucix_cleanup(ctx); … … 100 100 if(!sauth) 101 101 goto out; 102 ctx = ucix_init(cbictx, " zepttho", 1);102 ctx = ucix_init(cbictx, "luci", 1); 103 103 uci_set_savedir(ctx, "/var/state/"); 104 t = ucix_get_option_int(ctx, " zepttho", "session", sauth, 0);104 t = ucix_get_option_int(ctx, "luci", "session", sauth, 0); 105 105 if(t) 106 106 { 107 107 printf("logoff session %s\n", sauth); 108 ucix_revert(ctx, " zepttho", "session", sauth);109 ucix_save(ctx, " zepttho");108 ucix_revert(ctx, "luci", "session", sauth); 109 ucix_save(ctx, "luci"); 110 110 } 111 111 ucix_cleanup(ctx); … … 123 123 if(!pass) 124 124 return ret; 125 ctx = ucix_init(cbictx, " user", 0);126 passwd = ucix_get_option(ctx, " user", "user", "admin");125 ctx = ucix_init(cbictx, "luci", 0); 126 passwd = ucix_get_option(ctx, "luci", "user", "admin"); 127 127 ucix_cleanup(ctx); 128 128 if(passwd) … … 148 148 close(fd); 149 149 sprintf(salt, "$1$%02X$", buf); 150 ucictx = ucix_init(cbictx, " user", 1);151 ucix_add_option(ucictx, " user", "user", "admin", crypt(passwd1, salt));152 ucix_commit(ucictx, " user");150 ucictx = ucix_init(cbictx, "luci", 1); 151 ucix_add_option(ucictx, "luci", "user", "admin", crypt(passwd1, salt)); 152 ucix_commit(ucictx, "luci"); 153 153 ucix_cleanup(ucictx); 154 154 return 0;
