[928] | 1 | //
|
---|
[999] | 2 | // OSCam HTTP server module
|
---|
[928] | 3 | //
|
---|
[999] | 4 | #include "oscam-http-helpers.c"
|
---|
[928] | 5 | #include <stdio.h>
|
---|
| 6 | #include <string.h>
|
---|
| 7 | #include <time.h>
|
---|
| 8 | #include <sys/stat.h>
|
---|
| 9 | #include <dirent.h>
|
---|
[1023] | 10 | #include <sys/socket.h>
|
---|
[928] | 11 |
|
---|
[966] | 12 | static char* monlevel[] = {
|
---|
| 13 | "0 = no access to monitor",
|
---|
| 14 | "1 = only server and own procs",
|
---|
| 15 | "2 = all procs, but viewing only, default",
|
---|
| 16 | "3 = all procs, reload of oscam.user possible",
|
---|
[1019] | 17 | "4 = complete access"
|
---|
| 18 | };
|
---|
[966] | 19 |
|
---|
[965] | 20 | void refresh_oscam(enum refreshtypes refreshtype){
|
---|
[973] | 21 | int i;
|
---|
[965] | 22 | switch (refreshtype){
|
---|
| 23 | case REFR_ACCOUNTS:
|
---|
[973] | 24 | cs_log("Refresh Accounts requested by WebIF");
|
---|
[981] | 25 | init_userdb();
|
---|
[973] | 26 | cs_reinit_clients();
|
---|
| 27 | #ifdef CS_ANTICASC
|
---|
| 28 | for (i=0; i<CS_MAXPID; i++)
|
---|
| 29 | if (client[i].typ=='a') {
|
---|
| 30 | kill(client[i].pid, SIGHUP);
|
---|
| 31 | break;
|
---|
| 32 | }
|
---|
| 33 | #endif
|
---|
[965] | 34 | break;
|
---|
| 35 |
|
---|
| 36 | case REFR_READERS:
|
---|
| 37 | cs_log("Refresh Reader");
|
---|
| 38 | //todo how I can refresh the readers
|
---|
| 39 | break;
|
---|
| 40 |
|
---|
| 41 | case REFR_SERVER:
|
---|
[973] | 42 | cs_log("Refresh Server requested by WebIF");
|
---|
| 43 | //kill(client[0].pid, SIGHUP);
|
---|
[965] | 44 | //todo how I can refresh the server after global settings
|
---|
| 45 | break;
|
---|
[973] | 46 |
|
---|
[965] | 47 | #ifdef CS_ANTICASC
|
---|
| 48 | case REFR_ANTICASC:
|
---|
[973] | 49 | cs_log("Refresh Anticascading requested by WebIF");
|
---|
| 50 | for (i=0; i<CS_MAXPID; i++)
|
---|
| 51 | if (client[i].typ=='a') {
|
---|
| 52 | kill(client[i].pid, SIGHUP);
|
---|
| 53 | break;
|
---|
| 54 | }
|
---|
[965] | 55 | break;
|
---|
| 56 | #endif
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[999] | 60 | void send_oscam_config_global(FILE *f, struct uriparams *params) {
|
---|
[965] | 61 | int i;
|
---|
[951] | 62 |
|
---|
[976] | 63 | fprintf(f,"<BR><BR>");
|
---|
[1022] | 64 |
|
---|
[999] | 65 | if (strcmp(getParam(params, "action"), "execute") == 0){
|
---|
| 66 | //we found the execute flag
|
---|
| 67 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 68 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 69 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 70 | //we use the same function as used for parsing the config tokens
|
---|
| 71 | chk_t_global((*params).params[i], (*params).values[i]);
|
---|
[951] | 72 | }
|
---|
| 73 | }
|
---|
[976] | 74 |
|
---|
[999] | 75 | //Disclaimer
|
---|
| 76 | fprintf(f,"<BR><BR><B>Configuration Global *DONE*</B><BR><BR>");
|
---|
| 77 | refresh_oscam(REFR_SERVER);
|
---|
| 78 | } else {
|
---|
| 79 |
|
---|
| 80 | //if nothing above matches we show the form
|
---|
| 81 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 82 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"global\">\r\n");
|
---|
| 83 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 84 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 85 | fprintf(f,"\t<TH> </TH><TH>Edit Global Config </TH>");
|
---|
[1022] | 86 |
|
---|
[999] | 87 | //ServerIP
|
---|
| 88 | fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->srvip));
|
---|
| 89 | //Logfile
|
---|
| 90 | fprintf(f,"\t<TR><TD>Logfile:</TD><TD><input name=\"logfile\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", logfile);
|
---|
| 91 | //PID File
|
---|
| 92 | fprintf(f,"\t<TR><TD>PID File:</TD><TD><input name=\"pidfile\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", cfg->pidfile);
|
---|
| 93 | //Userfile
|
---|
| 94 | fprintf(f,"\t<TR><TD>Usrfile:</TD><TD><input name=\"usrfile\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", cfg->usrfile);
|
---|
| 95 | //Logfile
|
---|
| 96 | fprintf(f,"\t<TR><TD>CWlogdir:</TD><TD><input name=\"cwlogdir\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", cfg->cwlogdir);
|
---|
| 97 | //Clienttimeout
|
---|
| 98 | fprintf(f,"\t<TR><TD>Clienttimeout:</TD><TD><input name=\"clienttimeout\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%ld\"></TD></TR>\r\n", cfg->ctimeout);
|
---|
| 99 | //fallbacktimeout
|
---|
| 100 | fprintf(f,"\t<TR><TD>Fallbacktimeout:</TD><TD><input name=\"fallbacktimeout\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%ld\"></TD></TR>\r\n", cfg->ftimeout);
|
---|
| 101 | //clientmaxidle
|
---|
| 102 | fprintf(f,"\t<TR><TD>Clientmaxidle:</TD><TD><input name=\"clientmaxidle\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->cmaxidle);
|
---|
| 103 | //cachedelay
|
---|
| 104 | fprintf(f,"\t<TR><TD>Cachedelay:</TD><TD><input name=\"cachedelay\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%ld\"></TD></TR>\r\n", cfg->delay);
|
---|
| 105 | //bindwait
|
---|
| 106 | fprintf(f,"\t<TR><TD>Bindwait:</TD><TD><input name=\"bindwait\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->bindwait);
|
---|
| 107 | //netprio
|
---|
| 108 | fprintf(f,"\t<TR><TD>Netprio:</TD><TD><input name=\"netprio\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%ld\"></TD></TR>\r\n", cfg->netprio);
|
---|
| 109 | //resolvedelay
|
---|
| 110 | fprintf(f,"\t<TR><TD>Resolvedelay:</TD><TD><input name=\"resolvedelay\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->resolvedelay);
|
---|
| 111 | //sleep
|
---|
| 112 | fprintf(f,"\t<TR><TD>Sleep:</TD><TD><input name=\"sleep\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->tosleep);
|
---|
| 113 | //unlockparental
|
---|
| 114 | fprintf(f,"\t<TR><TD>Unlockparental:</TD><TD><input name=\"unlockparental\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ulparent);
|
---|
| 115 | //nice
|
---|
| 116 | fprintf(f,"\t<TR><TD>Nice:</TD><TD><input name=\"nice\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->nice);
|
---|
| 117 | //serialreadertimeout
|
---|
| 118 | fprintf(f,"\t<TR><TD>Serialreadertimeout:</TD><TD><input name=\"serialreadertimeout\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->srtimeout);
|
---|
| 119 | //maxlogsize
|
---|
| 120 | fprintf(f,"\t<TR><TD>Maxlogsize:</TD><TD><input name=\"maxlogsize\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->max_log_size);
|
---|
| 121 | //showecmdw
|
---|
| 122 | fprintf(f,"\t<TR><TD>Showecmdw:</TD><TD><input name=\"showecmdw\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->show_ecm_dw);
|
---|
| 123 | //waitforcards
|
---|
| 124 | fprintf(f,"\t<TR><TD>Waitforcards:</TD><TD><input name=\"waitforcards\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->waitforcards);
|
---|
| 125 | //preferlocalcards
|
---|
| 126 | fprintf(f,"\t<TR><TD>Preferlocalcards:</TD><TD><input name=\"preferlocalcards\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->preferlocalcards);
|
---|
[1022] | 127 |
|
---|
[999] | 128 | //Tablefoot and finish form
|
---|
| 129 | fprintf(f,"</TABLE>\r\n");
|
---|
| 130 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[1022] | 131 |
|
---|
[999] | 132 | //Disclaimer
|
---|
| 133 | fprintf(f,"<BR><BR>Configuration Global not yet implemented chengings havn't any effect<BR><BR>");
|
---|
[951] | 134 | }
|
---|
| 135 | }
|
---|
| 136 |
|
---|
[999] | 137 | void send_oscam_config_camd33(FILE *f, struct uriparams *params) {
|
---|
[960] | 138 | int i;
|
---|
| 139 |
|
---|
[976] | 140 | fprintf(f,"<BR><BR>");
|
---|
[973] | 141 |
|
---|
[999] | 142 | if (strcmp(getParam(params, "action"), "execute") == 0){
|
---|
| 143 | //we found the execute flag
|
---|
| 144 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 145 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 146 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 147 | //we use the same function as used for parsing the config tokens
|
---|
| 148 | chk_t_camd33((*params).params[i], (*params).values[i]);
|
---|
[952] | 149 | }
|
---|
| 150 | }
|
---|
[976] | 151 |
|
---|
[999] | 152 | //Disclaimer
|
---|
| 153 | fprintf(f,"<BR><BR><B>Configuration camd33 *DONE*</B><BR><BR>");
|
---|
| 154 | refresh_oscam(REFR_SERVER);
|
---|
| 155 | } else {
|
---|
| 156 |
|
---|
| 157 | //if nothing above matches we show the form
|
---|
| 158 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 159 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"camd33\">\r\n");
|
---|
| 160 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 161 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 162 | fprintf(f,"\t<TH> </TH><TH>Edit Camd33 Config </TH>");
|
---|
[1022] | 163 |
|
---|
[999] | 164 | //Port
|
---|
| 165 | fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->c33_port);
|
---|
| 166 | //ServerIP
|
---|
| 167 | fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip));
|
---|
| 168 | //Key
|
---|
| 169 | int keysize =sizeof(cfg->c33_key);
|
---|
| 170 | fprintf(f,"\t<TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"");
|
---|
| 171 | for (i=0;i<keysize;i++)
|
---|
| 172 | fprintf(f,"%02X",cfg->c33_key[i]);
|
---|
| 173 | fprintf(f,"\"></TD></TR>\r\n");
|
---|
| 174 | //Passive
|
---|
| 175 | fprintf(f,"\t<TR><TD>Passive:</TD><TD><input name=\"passive\" type=\"text\" size=\"3\" maxlength=\"1\" value=\"%d\"></TD></TR>\r\n", cfg->c33_passive);
|
---|
| 176 | //Nocrypt
|
---|
| 177 | fprintf(f,"\t<TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"");
|
---|
| 178 | struct s_ip *cip;
|
---|
| 179 | char *dot="";
|
---|
| 180 | for (cip=cfg->c33_plain; cip; cip=cip->next){
|
---|
| 181 | if (!(cip->ip[0] == cip->ip[1]))
|
---|
| 182 | fprintf(f,"%s%s-%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]), inet_ntoa(*(struct in_addr *)&cip->ip[1]));
|
---|
| 183 | else
|
---|
| 184 | fprintf(f,"%s%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]));
|
---|
| 185 | }
|
---|
| 186 | fprintf(f,"\">wrong, see Ticket #265</TD></TR>\r\n");
|
---|
[1022] | 187 |
|
---|
[999] | 188 | //Tablefoot and finish form
|
---|
| 189 | fprintf(f,"</TABLE>\r\n");
|
---|
| 190 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[1022] | 191 |
|
---|
[999] | 192 | //Disclaimer
|
---|
| 193 | fprintf(f,"<BR><BR>Configuration camd33 not yet implemented<BR><BR>");
|
---|
[952] | 194 | }
|
---|
[955] | 195 | }
|
---|
[952] | 196 |
|
---|
[999] | 197 | void send_oscam_config_camd35(FILE *f, struct uriparams *params) {
|
---|
[955] | 198 | int i;
|
---|
[952] | 199 |
|
---|
[975] | 200 | fprintf(f,"<BR><BR>");
|
---|
[973] | 201 |
|
---|
[999] | 202 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
[975] | 203 | //we found the execute flag
|
---|
[999] | 204 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 205 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 206 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
[975] | 207 | //we use the same function as used for parsing the config tokens
|
---|
[999] | 208 | chk_t_camd35((*params).params[i], (*params).values[i]);
|
---|
[975] | 209 | }
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | //Disclaimer
|
---|
| 213 | fprintf(f,"<BR><BR><B>Configuration camd35 *DONE*</B><BR><BR>");
|
---|
| 214 | refresh_oscam(REFR_SERVER);
|
---|
[999] | 215 | } else {
|
---|
| 216 | //if nothing above matches we show the form
|
---|
| 217 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 218 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"camd35\">\r\n");
|
---|
| 219 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 220 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 221 | fprintf(f,"\t<TH> </TH><TH>Edit Camd35 Config </TH>");
|
---|
[1022] | 222 |
|
---|
[999] | 223 | //Port
|
---|
| 224 | fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->c35_port);
|
---|
| 225 | //ServerIP
|
---|
| 226 | fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
|
---|
[1022] | 227 |
|
---|
[999] | 228 | //Tablefoot and finish form
|
---|
| 229 | fprintf(f,"</TABLE>\r\n");
|
---|
| 230 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[1022] | 231 |
|
---|
[999] | 232 | //Disclaimer
|
---|
| 233 | fprintf(f,"<BR><BR>Configuration camd35 not yet implemented<BR><BR>");
|
---|
[955] | 234 | }
|
---|
[951] | 235 | }
|
---|
| 236 |
|
---|
[999] | 237 | void send_oscam_config_newcamd(FILE *f, struct uriparams *params) {
|
---|
[955] | 238 | int i;
|
---|
[951] | 239 |
|
---|
[976] | 240 | fprintf(f,"<BR><BR>");
|
---|
[973] | 241 |
|
---|
[999] | 242 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
| 243 | //we found the execute flag
|
---|
| 244 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 245 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 246 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 247 | //we use the same function as used for parsing the config tokens
|
---|
| 248 | chk_t_newcamd((*params).params[i], (*params).values[i]);
|
---|
[955] | 249 | }
|
---|
| 250 | }
|
---|
[1022] | 251 |
|
---|
[999] | 252 | //Disclaimer
|
---|
| 253 | fprintf(f,"<BR><BR><B>Configuration newcamd *DONE*</B><BR><BR>");
|
---|
| 254 | refresh_oscam(REFR_SERVER);
|
---|
| 255 | } else {
|
---|
| 256 | //if nothing above matches we show the form
|
---|
| 257 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 258 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"newcamd\">\r\n");
|
---|
| 259 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 260 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 261 | fprintf(f,"\t<TH> </TH><TH>Edit Newcamd Config </TH>");
|
---|
[1022] | 262 |
|
---|
[999] | 263 | //Port
|
---|
| 264 | fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"80\" maxlength=\"200\" value=\"");
|
---|
| 265 | int j;
|
---|
| 266 | char *dot1, *dot2;
|
---|
| 267 | if (cfg->ncd_ptab.nports>0){
|
---|
| 268 | dot1 = "";
|
---|
| 269 | for(i=0;i<cfg->ncd_ptab.nports;i++){
|
---|
| 270 | dot2 = "";
|
---|
| 271 | fprintf(f, "%s%d", dot1, cfg->ncd_ptab.ports[i].s_port);
|
---|
| 272 | fprintf(f, "@%04X", cfg->ncd_ptab.ports[i].ftab.filts[0].caid);
|
---|
| 273 | if (cfg->ncd_ptab.ports[i].ftab.filts[0].nprids > 0){
|
---|
| 274 | fprintf(f, ":");
|
---|
| 275 | for (j = 0; j < cfg->ncd_ptab.ports[i].ftab.filts[0].nprids; j++){
|
---|
| 276 | fprintf(f,"%s%lX", dot2, cfg->ncd_ptab.ports[i].ftab.filts[0].prids[j]);
|
---|
| 277 | dot2 = ",";
|
---|
| 278 | }
|
---|
[976] | 279 | }
|
---|
[999] | 280 | dot1=";";
|
---|
[976] | 281 | }
|
---|
| 282 | }
|
---|
[1022] | 283 |
|
---|
[999] | 284 | fprintf(f,"\"></TD></TR>\r\n");
|
---|
[1022] | 285 |
|
---|
[999] | 286 | //ServerIP
|
---|
| 287 | fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip));
|
---|
| 288 | //Key
|
---|
| 289 | fprintf(f,"\t<TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"");
|
---|
[1022] | 290 |
|
---|
[999] | 291 | for (i=0;i<14;i++)
|
---|
| 292 | fprintf(f,"%02X",cfg->ncd_key[i]);
|
---|
[1022] | 293 |
|
---|
[999] | 294 | fprintf(f,"\"></TD></TR>\r\n");
|
---|
| 295 | //Tablefoot and finish form
|
---|
| 296 | fprintf(f,"</TABLE>\r\n");
|
---|
| 297 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[955] | 298 | }
|
---|
[951] | 299 | }
|
---|
| 300 |
|
---|
[999] | 301 | void send_oscam_config_radegast(FILE *f, struct uriparams *params) {
|
---|
[961] | 302 | int i;
|
---|
| 303 |
|
---|
[976] | 304 | fprintf(f,"<BR><BR>");
|
---|
[1022] | 305 |
|
---|
[999] | 306 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
| 307 | //we found the execute flag
|
---|
| 308 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 309 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 310 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 311 | //we use the same function as used for parsing the config tokens
|
---|
| 312 | chk_t_radegast((*params).params[i], (*params).values[i]);
|
---|
[961] | 313 | }
|
---|
| 314 | }
|
---|
[976] | 315 |
|
---|
[999] | 316 | //Disclaimer
|
---|
| 317 | fprintf(f,"<BR><BR><B>Configuration Radegast *DONE*</B><BR><BR>");
|
---|
| 318 | refresh_oscam(REFR_SERVER);
|
---|
| 319 | } else {
|
---|
| 320 |
|
---|
| 321 | //if nothing above matches we show the form
|
---|
| 322 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 323 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"radegast\">\r\n");
|
---|
| 324 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 325 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 326 | fprintf(f,"\t<TH> </TH><TH>Edit Radegast Config </TH>");
|
---|
[1022] | 327 |
|
---|
[999] | 328 | //Port
|
---|
| 329 | fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->rad_port);
|
---|
| 330 | //ServerIP
|
---|
| 331 | fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip));
|
---|
| 332 | //Allowed
|
---|
| 333 | fprintf(f,"\t<TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"");
|
---|
| 334 | struct s_ip *cip;
|
---|
| 335 | char *dot="";
|
---|
| 336 | for (cip=cfg->rad_allowed; cip; cip=cip->next){
|
---|
| 337 | if (!(cip->ip[0] == cip->ip[1]))
|
---|
| 338 | fprintf(f,"%s%s-%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]), inet_ntoa(*(struct in_addr *)&cip->ip[1]));
|
---|
| 339 | else
|
---|
| 340 | fprintf(f,"%s%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]));
|
---|
| 341 | }
|
---|
| 342 | fprintf(f,"\">wrong, see Ticket #265</TD></TR>\r\n");
|
---|
| 343 | //Port
|
---|
| 344 | fprintf(f,"\t<TR><TD>User:</TD><TD><input name=\"user\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", cfg->rad_usr);
|
---|
[1022] | 345 |
|
---|
[999] | 346 | //Tablefoot and finish form
|
---|
| 347 | fprintf(f,"</TABLE>\r\n");
|
---|
| 348 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[961] | 349 | }
|
---|
| 350 | }
|
---|
| 351 |
|
---|
[999] | 352 | void send_oscam_config_cccam(FILE *f, struct uriparams *params) {
|
---|
[961] | 353 | int i;
|
---|
| 354 |
|
---|
[976] | 355 | fprintf(f,"<BR><BR>");
|
---|
[973] | 356 |
|
---|
[999] | 357 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
| 358 | //we found the execute flag
|
---|
| 359 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 360 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 361 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 362 | //we use the same function as used for parsing the config tokens
|
---|
| 363 | chk_t_cccam((*params).params[i], (*params).values[i]);
|
---|
[961] | 364 | }
|
---|
| 365 | }
|
---|
[976] | 366 |
|
---|
[999] | 367 | //Disclaimer
|
---|
| 368 | fprintf(f,"<BR><BR>Configuration Cccam Do not yet implemented<BR><BR>");
|
---|
| 369 | refresh_oscam(REFR_SERVER);
|
---|
| 370 | } else {
|
---|
| 371 |
|
---|
| 372 | //if nothing above matches we show the form
|
---|
| 373 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 374 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"cccam\">\r\n");
|
---|
| 375 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 376 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 377 | fprintf(f,"\t<TH> </TH><TH>Edit Cccam Config </TH>");
|
---|
[1022] | 378 |
|
---|
| 379 |
|
---|
[999] | 380 | //Tablefoot and finish form
|
---|
| 381 | fprintf(f,"</TABLE>\r\n");
|
---|
| 382 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[1022] | 383 |
|
---|
[999] | 384 | //Disclaimer
|
---|
| 385 | fprintf(f,"<BR><BR>Configuration Cccam not yet implemented<BR><BR>");
|
---|
[961] | 386 | }
|
---|
| 387 | }
|
---|
| 388 |
|
---|
[999] | 389 | void send_oscam_config_gbox(FILE *f, struct uriparams *params) {
|
---|
[965] | 390 | int i;
|
---|
| 391 |
|
---|
[976] | 392 | fprintf(f,"<BR><BR>");
|
---|
[973] | 393 |
|
---|
[999] | 394 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
| 395 | //we found the execute flag
|
---|
| 396 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 397 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 398 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 399 | //we use the same function as used for parsing the config tokens
|
---|
| 400 | chk_t_gbox((*params).params[i], (*params).values[i]);
|
---|
[965] | 401 | }
|
---|
| 402 | }
|
---|
[976] | 403 |
|
---|
[999] | 404 | //Disclaimer
|
---|
| 405 | fprintf(f,"<BR><BR><B>Configuration Gbox *DONE*</B><BR><BR>");
|
---|
| 406 | refresh_oscam(REFR_SERVER);
|
---|
| 407 | } else {
|
---|
| 408 |
|
---|
| 409 | //if nothing above matches we show the form
|
---|
| 410 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 411 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"gbox\">\r\n");
|
---|
| 412 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 413 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 414 | fprintf(f,"\t<TH> </TH><TH>Edit Gbox Config </TH>");
|
---|
[1022] | 415 |
|
---|
[999] | 416 | //Password
|
---|
| 417 | fprintf(f,"\t<TR><TD>Password:</TD><TD><input name=\"password\" type=\"text\" size=\"10\" maxlength=\"8\" value=\"");
|
---|
| 418 | for (i=0;i<4;i++)
|
---|
| 419 | fprintf(f,"%02X",cfg->gbox_pwd[i]);
|
---|
| 420 | fprintf(f,"\"></TD></TR>\r\n");
|
---|
| 421 | //Maxdist
|
---|
| 422 | fprintf(f,"\t<TR><TD>Maxdist:</TD><TD><input name=\"maxdist\" type=\"text\" size=\"5\" maxlength=\"2\" value=\"%d\"></TD></TR>\r\n", cfg->maxdist);
|
---|
| 423 | //ignorelist
|
---|
| 424 | fprintf(f,"\t<TR><TD>Ignorelist:</TD><TD><input name=\"ignorelist\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"%s\"></TD></TR>\r\n", cfg->ignorefile);
|
---|
| 425 | //onlineinfos
|
---|
| 426 | fprintf(f,"\t<TR><TD>Onlineinfos:</TD><TD><input name=\"onlineinfos\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"%s\"></TD></TR>\r\n", cfg->gbxShareOnl);
|
---|
| 427 | //cardinfos
|
---|
| 428 | fprintf(f,"\t<TR><TD>Cardinfos:</TD><TD><input name=\"cardinfos\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"%s\"></TD></TR>\r\n", cfg->cardfile);
|
---|
| 429 | //locals
|
---|
| 430 | fprintf(f,"\t<TR><TD>Locals:</TD><TD><input name=\"locals\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"");
|
---|
| 431 | char *dot = "";
|
---|
| 432 | for (i = 0; i < cfg->num_locals; i++){
|
---|
| 433 | fprintf(f,"%s%06lX", dot, cfg->locals[i]);
|
---|
| 434 | dot=";";
|
---|
[976] | 435 | }
|
---|
[999] | 436 | fprintf(f,"\"></TD></TR>\r\n");
|
---|
[1022] | 437 |
|
---|
[999] | 438 | //Tablefoot and finish form
|
---|
| 439 | fprintf(f,"</TABLE>\r\n");
|
---|
| 440 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[965] | 441 | }
|
---|
| 442 | }
|
---|
| 443 |
|
---|
[999] | 444 | void send_oscam_config_monitor(FILE *f, struct uriparams *params) {
|
---|
[955] | 445 | int i;
|
---|
| 446 |
|
---|
[976] | 447 | fprintf(f,"<BR><BR>");
|
---|
[973] | 448 |
|
---|
[999] | 449 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
| 450 | //we found the execute flag
|
---|
| 451 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 452 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 453 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 454 | //we use the same function as used for parsing the config tokens
|
---|
| 455 | chk_t_monitor((*params).params[i], (*params).values[i]);
|
---|
[955] | 456 | }
|
---|
| 457 | }
|
---|
[976] | 458 |
|
---|
[999] | 459 | //Disclaimer
|
---|
| 460 | fprintf(f,"<BR><BR><B>Configuration Monitor *DONE*</B><BR><BR>");
|
---|
| 461 | refresh_oscam(REFR_SERVER);
|
---|
| 462 | } else {
|
---|
| 463 |
|
---|
| 464 | //if nothing above matches we show the form
|
---|
| 465 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 466 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"monitor\">\r\n");
|
---|
| 467 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 468 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 469 | fprintf(f,"\t<TH> </TH><TH>Edit Monitor Config </TH>");
|
---|
[1022] | 470 |
|
---|
[999] | 471 | //Port
|
---|
| 472 | fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->mon_port);
|
---|
| 473 | //ServerIP
|
---|
| 474 | fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->mon_srvip));
|
---|
| 475 | //Nocrypt
|
---|
| 476 | fprintf(f,"\t<TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"");
|
---|
| 477 | struct s_ip *cip;
|
---|
| 478 | char *dot="";
|
---|
| 479 | for (cip=cfg->mon_allowed; cip; cip=cip->next){
|
---|
| 480 | if (!(cip->ip[0] == cip->ip[1]))
|
---|
| 481 | fprintf(f,"%s%s-%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]), inet_ntoa(*(struct in_addr *)&cip->ip[1]));
|
---|
| 482 | else
|
---|
| 483 | fprintf(f,"%s%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]));
|
---|
| 484 | }
|
---|
| 485 | fprintf(f,"\">wrong, see Ticket #265</TD></TR>\r\n");
|
---|
| 486 | //aulow
|
---|
| 487 | fprintf(f,"\t<TR><TD>Aulow:</TD><TD><input name=\"aulow\" type=\"text\" size=\"5\" maxlength=\"1\" value=\"%d\"></TD></TR>\r\n", cfg->mon_aulow);
|
---|
| 488 | //Monlevel
|
---|
| 489 | fprintf(f,"<TR><TD>Monlevel:</TD><TD><select name=\"monlevel\" >\r\n");
|
---|
| 490 | for(i = 0; i < 5; i++){
|
---|
| 491 | if(i == cfg->mon_level)
|
---|
| 492 | fprintf(f,"\t<option value=\"%d\" selected>%s</option>\r\n", i, monlevel[i]);
|
---|
| 493 | else
|
---|
| 494 | fprintf(f,"\t<option value=\"%d\">%s</option>\r\n", i, monlevel[i]);
|
---|
[976] | 495 | }
|
---|
[999] | 496 | fprintf(f,"</select></TD></TR>\r\n");
|
---|
| 497 | //HTTPport
|
---|
| 498 | fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"httpport\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->http_port);
|
---|
| 499 | //hideclient_to
|
---|
| 500 | fprintf(f,"\t<TR><TD>Hideclientto:</TD><TD><input name=\"hideclient_to\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->mon_hideclient_to);
|
---|
| 501 | //HTTPuser
|
---|
| 502 | fprintf(f,"<TR><TD>Httpuser:</TD><TD><input name=\"httpuser\" type=\"text\" size=\"20\" maxlength=\"20\" value=\"%s\"></TD></TR>\r\n", cfg->http_user);
|
---|
| 503 | //HTTPpassword
|
---|
| 504 | fprintf(f,"<TR><TD>Httppwd:</TD><TD><input name=\"httppwd\" type=\"text\" size=\"20\" maxlength=\"20\" value=\"%s\"></TD></TR>\r\n", cfg->http_pwd);
|
---|
| 505 | //HTTPcss
|
---|
| 506 | fprintf(f,"<TR><TD>Httpcss:</TD><TD><input name=\"httpcss\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"%s\"></TD></TR>\r\n", cfg->http_css);
|
---|
| 507 | //HTTPrefresh
|
---|
| 508 | fprintf(f,"\t<TR><TD>Httprefresh:</TD><TD><input name=\"httprefresh\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->http_refresh);
|
---|
[1022] | 509 |
|
---|
[999] | 510 | //Tablefoot and finish form
|
---|
| 511 | fprintf(f,"</TABLE>\r\n");
|
---|
| 512 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[955] | 513 | }
|
---|
[951] | 514 | }
|
---|
| 515 |
|
---|
[955] | 516 | #ifdef CS_ANTICASC
|
---|
| 517 |
|
---|
[999] | 518 | void send_oscam_config_anticasc(FILE *f, struct uriparams *params) {
|
---|
[955] | 519 | int i;
|
---|
| 520 |
|
---|
[975] | 521 | fprintf(f,"<BR><BR>");
|
---|
[973] | 522 |
|
---|
[999] | 523 | if (strcmp(getParam(params, "action"),"execute") == 0){
|
---|
| 524 | //we found the execute flag
|
---|
| 525 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 526 | if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
|
---|
| 527 | fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", (*params).params[i], (*params).values[i]);
|
---|
| 528 | //we use the same function as used for parsing the config tokens
|
---|
| 529 | chk_t_ac((*params).params[i], (*params).values[i]);
|
---|
[955] | 530 | }
|
---|
| 531 | }
|
---|
[975] | 532 |
|
---|
[999] | 533 | //Disclaimer
|
---|
| 534 | fprintf(f,"<BR><BR><B>Configuration Anticascading *DONE*</B><BR><BR>");
|
---|
| 535 | refresh_oscam(REFR_ANTICASC);
|
---|
| 536 | } else{
|
---|
| 537 |
|
---|
| 538 | //if nothing above matches we show the form
|
---|
| 539 | fprintf(f,"<form action=\"/config.html\" method=\"get\">\r\n");
|
---|
| 540 | fprintf(f,"<input name=\"part\" type=\"hidden\" value=\"anticasc\">\r\n");
|
---|
| 541 | fprintf(f,"<input name=\"action\" type=\"hidden\" value=\"execute\">\r\n");
|
---|
| 542 | fprintf(f,"<TABLE cellspacing=\"0\">");
|
---|
| 543 | fprintf(f,"\t<TH> </TH><TH>Edit Anticascading Config </TH>");
|
---|
[1022] | 544 |
|
---|
[999] | 545 | //Port
|
---|
| 546 | char *checked="";
|
---|
| 547 | if (cfg->ac_enabled > 0) checked="checked";
|
---|
| 548 | fprintf(f,"\t<TR><TD>Enabled:</TD><TD><input name=\"enabled\" type=\"checkbox\" value=\"1\" %s>\r\n", checked);
|
---|
| 549 | //numusers
|
---|
| 550 | fprintf(f,"\t<TR><TD>Numusers:</TD><TD><input name=\"numusers\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_users);
|
---|
| 551 | //sampletime
|
---|
| 552 | fprintf(f,"\t<TR><TD>Sampletime:</TD><TD><input name=\"sampletime\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_stime);
|
---|
| 553 | //samples
|
---|
| 554 | fprintf(f,"\t<TR><TD>Samples:</TD><TD><input name=\"samples\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_samples);
|
---|
| 555 | //penalty
|
---|
| 556 | fprintf(f,"\t<TR><TD>Penalty:</TD><TD><input name=\"penalty\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_penalty);
|
---|
| 557 | //aclogfile
|
---|
| 558 | fprintf(f,"\t<TR><TD>AClogfile:</TD><TD><input name=\"aclogfile\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"%s\"></TD></TR>\r\n", cfg->ac_logfile);
|
---|
| 559 | //fakedelay
|
---|
| 560 | fprintf(f,"\t<TR><TD>Fakedelay:</TD><TD><input name=\"fakedelay\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_fakedelay);
|
---|
| 561 | //denysamples
|
---|
| 562 | fprintf(f,"\t<TR><TD>Denysamples:</TD><TD><input name=\"denysamples\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_denysamples);
|
---|
[1022] | 563 |
|
---|
[999] | 564 | //Tablefoot and finish form
|
---|
| 565 | fprintf(f,"</TABLE>\r\n");
|
---|
| 566 | fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n");
|
---|
[955] | 567 | }
|
---|
| 568 | }
|
---|
| 569 |
|
---|
| 570 | #endif
|
---|
| 571 |
|
---|
[999] | 572 | void send_oscam_config(FILE *f, struct uriparams *params) {
|
---|
[951] | 573 | fprintf(f,"<BR><BR>");
|
---|
| 574 |
|
---|
| 575 | /*create submenue*/
|
---|
| 576 | fprintf(f, "<TABLE border=0 class=\"menu\">\n");
|
---|
| 577 | fprintf(f, " <TR>\n");
|
---|
[999] | 578 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=global\">Global</TD>\n");
|
---|
| 579 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=camd33\">Camd3.3</TD>\n");
|
---|
| 580 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=camd35\">Camd3.5</TD>\n");
|
---|
| 581 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=newcamd\">Newcamd</TD>\n");
|
---|
| 582 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=radegast\">Radegast</TD>\n");
|
---|
| 583 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=cccam\">Cccam</TD>\n");
|
---|
| 584 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=gbox\">Gbox</TD>\n");
|
---|
[955] | 585 | #ifdef CS_ANTICASC
|
---|
[999] | 586 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=anticasc\">Anticascading</TD>\n");
|
---|
[955] | 587 | #endif
|
---|
[999] | 588 | fprintf(f, " <TD CLASS=\"menu\"><A HREF=\"config.html?part=monitor\">Monitor</TD>\n");
|
---|
[951] | 589 | fprintf(f, " </TR>\n");
|
---|
| 590 | fprintf(f, "</TABLE>\n");
|
---|
| 591 |
|
---|
[999] | 592 | char *part = getParam(params, "part");
|
---|
| 593 | if (strlen(part) == 0)
|
---|
| 594 | send_oscam_config_global(f, params);
|
---|
| 595 | else {
|
---|
| 596 | if (!strcmp(part,"global"))
|
---|
| 597 | send_oscam_config_global(f, params);
|
---|
| 598 | else if (!strcmp(part,"camd33"))
|
---|
| 599 | send_oscam_config_camd33(f, params);
|
---|
| 600 | else if (!strcmp(part,"camd35"))
|
---|
| 601 | send_oscam_config_camd35(f, params);
|
---|
| 602 | else if (!strcmp(part,"newcamd"))
|
---|
| 603 | send_oscam_config_newcamd(f, params);
|
---|
| 604 | else if (!strcmp(part,"radegast"))
|
---|
| 605 | send_oscam_config_radegast(f, params);
|
---|
| 606 | else if (!strcmp(part,"cccam"))
|
---|
| 607 | send_oscam_config_cccam(f, params);
|
---|
| 608 | else if (!strcmp(part,"gbox"))
|
---|
| 609 | send_oscam_config_gbox(f, params);
|
---|
[955] | 610 | #ifdef CS_ANTICASC
|
---|
[999] | 611 | else if (!strcmp(part,"anticasc"))
|
---|
| 612 | send_oscam_config_anticasc(f, params);
|
---|
[955] | 613 | #endif
|
---|
[999] | 614 | else if (!strcmp(part,"monitor"))
|
---|
| 615 | send_oscam_config_monitor(f, params);
|
---|
[951] | 616 | else
|
---|
[999] | 617 | send_oscam_config_global(f, params);
|
---|
[951] | 618 | }
|
---|
| 619 | }
|
---|
| 620 |
|
---|
[1019] | 621 | void send_oscam_reader(struct templatevars *vars, FILE *f) {
|
---|
[945] | 622 | int ridx;
|
---|
| 623 | char *ctyp;
|
---|
| 624 |
|
---|
| 625 | for(ridx=0;ridx<CS_MAXREADER;ridx++){
|
---|
| 626 | if(!reader[ridx].device[0]) break;
|
---|
[1019] | 627 | switch(reader[ridx].typ){
|
---|
[945] | 628 | case R_MOUSE : ctyp="mouse"; break;
|
---|
| 629 | case R_INTERNAL: ctyp="intern"; break;
|
---|
| 630 | case R_SMART : ctyp="smartreader"; break;
|
---|
| 631 | case R_CAMD35 : ctyp="camd 3.5x";break;
|
---|
| 632 | case R_CAMD33 : ctyp="camd 3.3x";break;
|
---|
| 633 | case R_NEWCAMD : ctyp="newcamd"; break;
|
---|
| 634 | case R_RADEGAST: ctyp="radegast"; break;
|
---|
| 635 | case R_SERIAL : ctyp="serial"; break;
|
---|
| 636 | case R_GBOX : ctyp="gbox"; break;
|
---|
| 637 | #ifdef HAVE_PCSC
|
---|
| 638 | case R_PCSC : ctyp="pcsc"; break;
|
---|
| 639 | #endif
|
---|
| 640 | case R_CCCAM : ctyp="cccam"; break;
|
---|
| 641 | case R_CS378X : ctyp="cs378x"; break;
|
---|
| 642 | default : ctyp="unknown"; break;
|
---|
| 643 | }
|
---|
[1019] | 644 | tpl_addVar(vars, 0, "CTYP", ctyp);
|
---|
| 645 | tpl_addVar(vars, 0, "READERNAME", reader[ridx].label);
|
---|
| 646 | tpl_addVar(vars, 0, "READERNAMEENC", tpl_addTmp(vars, urlencode(reader[ridx].label)));
|
---|
| 647 | tpl_addVar(vars, 1, "READERLIST", tpl_getTpl(vars, "READERSBIT"));
|
---|
[945] | 648 | }
|
---|
[1019] | 649 | fputs(tpl_getTpl(vars, "READERS"), f);
|
---|
[945] | 650 | }
|
---|
| 651 |
|
---|
[1019] | 652 | void send_oscam_reader_config(struct templatevars *vars, FILE *f, struct uriparams *params) {
|
---|
| 653 | int ridx;
|
---|
[999] | 654 | char *reader_ = getParam(params, "reader");
|
---|
[1019] | 655 | for(ridx = 0; ridx < CS_MAXREADER && strcmp(reader_, reader[ridx].label) != 0; ++ridx);
|
---|
| 656 | if(ridx == CS_MAXREADER){
|
---|
| 657 | tpl_addVar(vars, 0, "MESSAGE", "<BR><BR>Reader not found<BR><BR>");
|
---|
| 658 | } else if(strcmp(getParam(params, "action"), "execute") == 0){
|
---|
| 659 | tpl_addVar(vars, 0, "MESSAGE", "<BR><BR>Saving not yet implemented<BR><BR>");
|
---|
| 660 | refresh_oscam(REFR_READERS);
|
---|
[945] | 661 | }
|
---|
[1019] | 662 | int i;
|
---|
| 663 | tpl_addVar(vars, 0, "READERNAME", reader[ridx].label);
|
---|
| 664 | tpl_addVar(vars, 0, "DEVICE", reader[ridx].device);
|
---|
| 665 | tpl_addVar(vars, 0, "NCD_KEY", (char *)reader[ridx].ncd_key);
|
---|
| 666 | tpl_addVar(vars, 0, "PINCODE", reader[ridx].pincode);
|
---|
| 667 | tpl_addVar(vars, 0, "EMMFILE", (char *)reader[ridx].emmfile);
|
---|
| 668 | tpl_addVar(vars, 0, "GBOXPWD", (char *)reader[ridx].gbox_pwd);
|
---|
| 669 | tpl_printf(vars, 0, "INACTIVITYTIMEOUT", "%d", reader[ridx].tcp_ito);
|
---|
| 670 | tpl_printf(vars, 0, "RECEIVETIMEOUT", "%d", reader[ridx].tcp_rto);
|
---|
| 671 | tpl_printf(vars, 0, "DISABLESERVERFILTER", "%d", reader[ridx].ncd_disable_server_filt);
|
---|
| 672 | tpl_printf(vars, 0, "FALLBACK", "%d", reader[ridx].fallback);
|
---|
| 673 | tpl_printf(vars, 0, "LOGPORT", "%d", reader[ridx].log_port);
|
---|
| 674 | tpl_printf(vars, 0, "BOXID", "%ld", reader[ridx].boxid);
|
---|
[945] | 675 |
|
---|
[1021] | 676 | if(reader[ridx].r_port) tpl_printf(vars, 0, "R_PORT", ",%d", reader[ridx].r_port);
|
---|
| 677 | if(reader[ridx].l_port) {
|
---|
| 678 | if(reader[ridx].r_port) tpl_printf(vars, 0, "L_PORT", ",%d", reader[ridx].l_port);
|
---|
| 679 | else tpl_printf(vars, 0, "L_PORT", ",,%d", reader[ridx].l_port);
|
---|
| 680 | }
|
---|
[945] | 681 |
|
---|
[966] | 682 | //Group
|
---|
| 683 | /*restore the settings format of group from long over bitarray*/
|
---|
| 684 | char *dot = ""; //flag for comma
|
---|
| 685 | char grpbit[33];
|
---|
| 686 | long2bitchar(reader[ridx].grp, grpbit);
|
---|
| 687 | for(i = 0; i < 32; i++){
|
---|
| 688 | if (grpbit[i] == '1'){
|
---|
[1019] | 689 | tpl_printf(vars, 1, "GRP", "%s%d", dot, i+1);
|
---|
[966] | 690 | dot = ",";
|
---|
| 691 | }
|
---|
| 692 | }
|
---|
[955] | 693 |
|
---|
| 694 | //services
|
---|
| 695 | char sidok[33];
|
---|
| 696 | long2bitchar(reader[ridx].sidtabok, sidok);
|
---|
| 697 | char sidno[33];
|
---|
| 698 | long2bitchar(reader[ridx].sidtabno,sidno);
|
---|
| 699 | struct s_sidtab *sidtab = cfg->sidtab;
|
---|
| 700 | //build matrix
|
---|
[1019] | 701 | while(sidtab != NULL){
|
---|
| 702 | tpl_addVar(vars, 0, "SIDLABEL", sidtab->label);
|
---|
| 703 | if(sidok[i]=='1') tpl_addVar(vars, 0, "CHECKED", "checked");
|
---|
| 704 | else tpl_addVar(vars, 0, "CHECKED", "");
|
---|
| 705 | tpl_addVar(vars, 1, "SIDS", tpl_getTpl(vars, "READERCONFIGSIDOKBIT"));
|
---|
| 706 | if(sidno[i]=='1') tpl_addVar(vars, 0, "CHECKED", "checked");
|
---|
| 707 | else tpl_addVar(vars, 0, "CHECKED", "");
|
---|
| 708 | tpl_addVar(vars, 1, "SIDS", tpl_getTpl(vars, "READERCONFIGSIDNOBIT"));
|
---|
| 709 | sidtab=sidtab->next;
|
---|
[955] | 710 | }
|
---|
| 711 |
|
---|
[1019] | 712 | // CAID
|
---|
[966] | 713 | i = 0;
|
---|
| 714 | CAIDTAB *ctab = &reader[ridx].ctab;
|
---|
| 715 | while(ctab->caid[i]) {
|
---|
[1019] | 716 | if (i == 0) tpl_printf(vars, 1, "CAIDS", "%04X", ctab->caid[i]);
|
---|
| 717 | else tpl_printf(vars, 1, "CAIDS", ",%04X", ctab->caid[i]);;
|
---|
| 718 | if(ctab->mask[i]) tpl_printf(vars, 1, "CAIDS", "&%04X", ctab->mask[i]);
|
---|
[966] | 719 | i++;
|
---|
| 720 | }
|
---|
[1019] | 721 | fputs(tpl_getTpl(vars, "READERCONFIG"), f);
|
---|
[966] | 722 | }
|
---|
| 723 |
|
---|
[1019] | 724 | void send_oscam_user_config_edit(struct templatevars *vars, FILE *f, struct uriparams *params){
|
---|
| 725 | struct s_auth *account, *ptr;
|
---|
| 726 | char *user = getParam(params, "user");
|
---|
| 727 | int i, j;
|
---|
[966] | 728 |
|
---|
[1019] | 729 | for (account = cfg->account; account != NULL && strcmp(user, account->usr) != 0; account = account->next);
|
---|
[945] | 730 |
|
---|
[1019] | 731 | // Create a new user if it doesn't yet
|
---|
| 732 | if (account == NULL){
|
---|
| 733 | if (!(account=malloc(sizeof(struct s_auth)))){
|
---|
[989] | 734 | cs_log("Error allocating memory (errno=%d)", errno);
|
---|
| 735 | return;
|
---|
| 736 | }
|
---|
[1019] | 737 | if(cfg->account == NULL) cfg->account = account;
|
---|
| 738 | else {
|
---|
| 739 | for (ptr = cfg->account; ptr != NULL && ptr->next != NULL; ptr = ptr->next);
|
---|
| 740 | ptr->next = account;
|
---|
| 741 | }
|
---|
[989] | 742 | memset(account, 0, sizeof(struct s_auth));
|
---|
[1019] | 743 | strncpy((char *)account->usr, user, sizeof(account->usr)-1);
|
---|
[989] | 744 | account->au=(-1);
|
---|
| 745 | account->monlvl=cfg->mon_level;
|
---|
| 746 | account->tosleep=cfg->tosleep;
|
---|
| 747 | for (i=1; i<CS_MAXCAIDTAB; account->ctab.mask[i++]=0xffff);
|
---|
| 748 | for (i=1; i<CS_MAXTUNTAB; account->ttab.bt_srvid[i++]=0x0000);
|
---|
| 749 | #ifdef CS_ANTICASC
|
---|
| 750 | account->ac_users=cfg->ac_users;
|
---|
| 751 | account->ac_penalty=cfg->ac_penalty;
|
---|
[1019] | 752 | account->ac_idx = account->ac_idx + 1;
|
---|
[989] | 753 | #endif
|
---|
[1019] | 754 | tpl_addVar(vars, 1, "MESSAGE", "<b>New user has been added with default settings</b><BR>");
|
---|
| 755 | if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS);
|
---|
[1022] | 756 | else tpl_addVar(vars, 1, "MESSAGE", "<b>Writing configuration to disk failed!</b><BR>");
|
---|
[1019] | 757 | // need to reget account as writing to disk changes account!
|
---|
| 758 | for (account = cfg->account; account != NULL && strcmp(user, account->usr) != 0; account = account->next);
|
---|
[989] | 759 | }
|
---|
| 760 |
|
---|
[1019] | 761 | if(strcmp(getParam(params, "action"), "execute") == 0){
|
---|
[955] | 762 | char servicelabels[255]="";
|
---|
[981] | 763 | //clear group
|
---|
| 764 | account->grp = 0;
|
---|
| 765 |
|
---|
[999] | 766 | for(i=0;i<(*params).paramcount;i++){
|
---|
| 767 | if ((strcmp((*params).params[i], "action")) && (strcmp((*params).params[i], "user"))){
|
---|
| 768 | if (!strcmp((*params).params[i], "services"))
|
---|
| 769 | sprintf(servicelabels + strlen(servicelabels), "%s,", (*params).values[i]);
|
---|
[973] | 770 | else
|
---|
[999] | 771 | chk_account((*params).params[i], (*params).values[i], account);
|
---|
[955] | 772 | }
|
---|
[937] | 773 | }
|
---|
[973] | 774 | chk_account("services", servicelabels, account);
|
---|
[1022] | 775 | tpl_addVar(vars, 1, "MESSAGE", "<B>Settings updated</B><BR><BR>");
|
---|
[1019] | 776 | if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS);
|
---|
| 777 | else tpl_addVar(vars, 1, "MESSAGE", "<B>Write Config failed</B><BR><BR>");
|
---|
[955] | 778 | }
|
---|
| 779 |
|
---|
[1019] | 780 | tpl_addVar(vars, 0, "USERNAME", account->usr);
|
---|
[1022] | 781 | tpl_addVar(vars, 0, "PASSWORD", account->pwd);
|
---|
[935] | 782 |
|
---|
[986] | 783 | //Expirationdate
|
---|
| 784 | struct tm * timeinfo = localtime (&account->expirationdate);
|
---|
| 785 | char buf [80];
|
---|
| 786 | strftime (buf,80,"%Y-%m-%d",timeinfo);
|
---|
[1019] | 787 | if(strcmp(buf,"1970-01-01")) tpl_addVar(vars, 0, "EXPDATE", buf);
|
---|
[965] | 788 | //Group
|
---|
[949] | 789 | /*restore the settings format of group from long over bitarray*/
|
---|
[966] | 790 | char *dot = ""; //flag for comma
|
---|
[949] | 791 | char grpbit[33];
|
---|
| 792 | long2bitchar(account->grp, grpbit);
|
---|
| 793 | for(i = 0; i < 32; i++){
|
---|
| 794 | if (grpbit[i] == '1'){
|
---|
[1019] | 795 | tpl_printf(vars, 1, "GROUPS", "%s%d", dot, i+1);
|
---|
[966] | 796 | dot = ",";
|
---|
[935] | 797 | }
|
---|
[981] | 798 | }
|
---|
[966] | 799 | //Hostname
|
---|
[1019] | 800 | tpl_addVar(vars, 0, "DYNDNS", (char *)account->dyndns);
|
---|
[1022] | 801 |
|
---|
[966] | 802 | //Uniq
|
---|
[1019] | 803 | tpl_printf(vars, 0, "TMP", "UNIQSELECTED%d", account->uniq);
|
---|
| 804 | tpl_addVar(vars, 0, tpl_getVar(vars, "TMP"), "selected");
|
---|
[1022] | 805 |
|
---|
[966] | 806 | //Sleep
|
---|
[1019] | 807 | if(!account->tosleep) tpl_addVar(vars, 0, "SLEEP", "0");
|
---|
| 808 | else tpl_printf(vars, 0, "SLEEP", "%d", account->tosleep);
|
---|
[966] | 809 | //Monlevel selector
|
---|
[1019] | 810 | tpl_printf(vars, 0, "TMP", "MONSELECTED%d", account->monlvl);
|
---|
| 811 | tpl_addVar(vars, 0, tpl_getVar(vars, "TMP"), "selected");
|
---|
| 812 |
|
---|
[966] | 813 | //AU Selector
|
---|
[1019] | 814 | if (!account->au) tpl_addVar(vars, 0, "AUSELECTED", "selected");
|
---|
| 815 | if (account->autoau == 1) tpl_addVar(vars, 0, "AUTOAUSELECTED", "selected");
|
---|
[937] | 816 | int ridx;
|
---|
| 817 | for (ridx=0; ridx<CS_MAXREADER; ridx++){
|
---|
| 818 | if(!reader[ridx].device[0]) break;
|
---|
[1019] | 819 | tpl_addVar(vars, 0, "READERNAME", reader[ridx].label);
|
---|
| 820 | if (account->au == ridx) tpl_addVar(vars, 0, "SELECTED", "selected");
|
---|
| 821 | else tpl_addVar(vars, 0, "SELECTED", "");
|
---|
| 822 | tpl_addVar(vars, 1, "RDROPTION", tpl_getTpl(vars, "USEREDITRDRSELECTED"));
|
---|
[937] | 823 | }
|
---|
[935] | 824 |
|
---|
[1019] | 825 | /* SERVICES */
|
---|
[955] | 826 | //services - first we have to move the long sidtabok/sidtabno to a binary array
|
---|
[948] | 827 | char sidok[33];
|
---|
[949] | 828 | long2bitchar(account->sidtabok,sidok);
|
---|
[948] | 829 | char sidno[33];
|
---|
[949] | 830 | long2bitchar(account->sidtabno,sidno);
|
---|
[948] | 831 | struct s_sidtab *sidtab = cfg->sidtab;
|
---|
[955] | 832 | //build matrix
|
---|
[1022] | 833 | i=0;
|
---|
[1019] | 834 | while(sidtab != NULL){
|
---|
| 835 | tpl_addVar(vars, 0, "SIDLABEL", sidtab->label);
|
---|
| 836 | if(sidok[i]=='1') tpl_addVar(vars, 0, "CHECKED", "checked");
|
---|
| 837 | else tpl_addVar(vars, 0, "CHECKED", "");
|
---|
| 838 | tpl_addVar(vars, 1, "SIDS", tpl_getTpl(vars, "USEREDITSIDOKBIT"));
|
---|
| 839 | if(sidno[i]=='1') tpl_addVar(vars, 0, "CHECKED", "checked");
|
---|
| 840 | else tpl_addVar(vars, 0, "CHECKED", "");
|
---|
| 841 | tpl_addVar(vars, 1, "SIDS", tpl_getTpl(vars, "USEREDITSIDNOBIT"));
|
---|
| 842 | sidtab=sidtab->next;
|
---|
[1022] | 843 | i++;
|
---|
[948] | 844 | }
|
---|
[1019] | 845 | /* CAID */
|
---|
| 846 | dot="";
|
---|
[955] | 847 | i = 0;
|
---|
| 848 | CAIDTAB *ctab = &account->ctab;
|
---|
[937] | 849 | while(ctab->caid[i]) {
|
---|
[1019] | 850 | tpl_printf(vars, 1, "CAIDS", "%s%04X", dot, ctab->caid[i]);
|
---|
| 851 | if(ctab->mask[i]) tpl_printf(vars, 1, "CAIDS", "&%04X", ctab->mask[i]);
|
---|
| 852 | if(ctab->cmap[i]) tpl_printf(vars, 1, "CAIDS", ":%04X", ctab->cmap[i]);
|
---|
| 853 | dot=",";
|
---|
| 854 | ++i;
|
---|
[937] | 855 | }
|
---|
[935] | 856 |
|
---|
[951] | 857 | /*IDENT*/
|
---|
[994] | 858 | dot="";
|
---|
| 859 | FTAB *ftab = &account->ftab;
|
---|
[1019] | 860 | for (i = 0; i < ftab->nfilts; ++i){
|
---|
| 861 | tpl_printf(vars, 1, "IDENTS", "%s%04X", dot, ftab->filts[i].caid);
|
---|
| 862 | dot=":";
|
---|
| 863 | for (j = 0; j < ftab->filts[i].nprids; ++j) {
|
---|
| 864 | tpl_printf(vars, 1, "IDENTS", "%s%06lX", dot, ftab->filts[i].prids[j]);
|
---|
| 865 | dot=",";
|
---|
| 866 | }
|
---|
[994] | 867 | dot=";";
|
---|
| 868 | }
|
---|
| 869 |
|
---|
[937] | 870 | /*Betatunnel*/
|
---|
[1019] | 871 | dot="";
|
---|
[955] | 872 | i = 0;
|
---|
| 873 | TUNTAB *ttab = &account->ttab;
|
---|
[937] | 874 | while(ttab->bt_caidfrom[i]) {
|
---|
[1019] | 875 | tpl_printf(vars, 1, "BETATUNNELS", "%s%04X", dot, ttab->bt_caidfrom[i]);
|
---|
| 876 | if(ttab->bt_srvid[i]) tpl_printf(vars, 1, "BETATUNNELS", ".%04X", ttab->bt_srvid[i]);
|
---|
| 877 | if(ttab->bt_caidto[i]) tpl_printf(vars, 1, "BETATUNNELS", ":%04X", ttab->bt_caidto[i]);
|
---|
| 878 | dot=",";
|
---|
| 879 | ++i;
|
---|
[937] | 880 | }
|
---|
[951] | 881 |
|
---|
| 882 | #ifdef CS_ANTICASC
|
---|
[1019] | 883 | tpl_printf(vars, 0, "AC_USERS", "%d", account->ac_users);
|
---|
| 884 | tpl_printf(vars, 0, "AC_PENALTY", "%d", account->ac_penalty);
|
---|
[951] | 885 | #endif
|
---|
[1019] | 886 | fputs(tpl_getTpl(vars, "USEREDIT"), f);
|
---|
[937] | 887 | }
|
---|
| 888 |
|
---|
[1019] | 889 | void send_oscam_user_config(struct templatevars *vars, FILE *f, struct uriparams *params) {
|
---|
[1022] | 890 | struct s_auth *account, *account2;
|
---|
[1019] | 891 | char *user = getParam(params, "user");
|
---|
| 892 | int i, found = 0;
|
---|
[929] | 893 |
|
---|
[1019] | 894 | if (strcmp(getParam(params, "action"), "delete") == 0){
|
---|
| 895 | account=cfg->account;
|
---|
| 896 | if(strcmp(account->usr, user) == 0){
|
---|
| 897 | cfg->account = account->next;
|
---|
| 898 | free(account);
|
---|
| 899 | found = 1;
|
---|
| 900 | } else if (account->next != NULL){
|
---|
| 901 | do{
|
---|
| 902 | if(strcmp(account->next->usr, user) == 0){
|
---|
| 903 | account2 = account->next;
|
---|
| 904 | account->next = account2->next;
|
---|
| 905 | free(account2);
|
---|
| 906 | found = 1;
|
---|
| 907 | break;
|
---|
| 908 | }
|
---|
| 909 | } while ((account = account->next) && (account->next != NULL));
|
---|
| 910 | }
|
---|
[929] | 911 |
|
---|
[1019] | 912 | if (found > 0){
|
---|
| 913 | tpl_addVar(vars, 1, "MESSAGE", "<b>Account has been deleted!</b><BR>");
|
---|
| 914 | if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS);
|
---|
| 915 | else tpl_addVar(vars, 1, "MESSAGE", "<b>Writing configuration to disk failed!</b><BR>");
|
---|
| 916 | } else tpl_addVar(vars, 1, "MESSAGE", "<b>Sorry but the specified user doesn't exist. No deletion will be made!</b><BR>");
|
---|
| 917 | }
|
---|
| 918 | /* List accounts*/
|
---|
| 919 | char *status = "offline";
|
---|
| 920 | char *expired = "";
|
---|
| 921 | char *classname="offline";
|
---|
| 922 | char *lastchan=" ";
|
---|
| 923 | time_t now = time((time_t)0);
|
---|
| 924 | int isec=0;
|
---|
[935] | 925 |
|
---|
[1019] | 926 | for (account=cfg->account; (account) ; account=account->next){
|
---|
| 927 | expired = ""; classname="offline";
|
---|
| 928 | if(account->expirationdate && account->expirationdate<time(NULL)){
|
---|
| 929 | expired = " (expired)";
|
---|
| 930 | classname = "expired";
|
---|
[939] | 931 | }
|
---|
[1019] | 932 | status="offline";
|
---|
[939] | 933 |
|
---|
[1019] | 934 | //search account in active clients
|
---|
| 935 | for (i=0; i<CS_MAXPID; i++)
|
---|
| 936 | if (!strcmp(client[i].usr, account->usr)){
|
---|
| 937 | //30 secs without ecm is offline
|
---|
| 938 | if ((now - client[i].lastecm) < 30){
|
---|
| 939 | status = "<b>online</b>";classname="online";
|
---|
| 940 | lastchan = monitor_get_srvname(client[i].last_srvid);
|
---|
| 941 | isec = now - client[i].last;
|
---|
[939] | 942 | }
|
---|
| 943 | }
|
---|
[1019] | 944 | tpl_addVar(vars, 0, "CLASSNAME", classname);
|
---|
| 945 | tpl_addVar(vars, 0, "USER", account->usr);
|
---|
| 946 | tpl_addVar(vars, 0, "USERENC", tpl_addTmp(vars, urlencode(account->usr)));
|
---|
| 947 | tpl_addVar(vars, 0, "STATUS", status);
|
---|
| 948 | tpl_addVar(vars, 0, "EXPIRED", expired);
|
---|
| 949 | tpl_addVar(vars, 0, "LASTCHANNEL", lastchan);
|
---|
| 950 | tpl_printf(vars, 0, "IDLESECS", "%d", isec);
|
---|
| 951 | tpl_addVar(vars, 1, "USERCONFIGS", tpl_getTpl(vars, "USERCONFIGLISTBIT"));
|
---|
| 952 | isec = 0;
|
---|
| 953 | lastchan = " ";
|
---|
| 954 | }
|
---|
| 955 | fputs(tpl_getTpl(vars, "USERCONFIGLIST"), f);
|
---|
| 956 | }
|
---|
[940] | 957 |
|
---|
[1019] | 958 | void send_oscam_entitlement(struct templatevars *vars, FILE *f, struct uriparams *params) {
|
---|
| 959 | /* build entitlements from reader init history */
|
---|
| 960 | int ridx;
|
---|
| 961 | char *p;
|
---|
| 962 | char *reader_ = getParam(params, "reader");
|
---|
[1022] | 963 | if(strlen(reader_) > 0){
|
---|
[931] | 964 | #ifdef CS_RDR_INIT_HIST
|
---|
[1019] | 965 | for (ridx=0; ridx<CS_MAXREADER && strcmp(reader_, reader[ridx].label) != 0; ridx++);
|
---|
| 966 | if(ridx<CS_MAXREADER){
|
---|
| 967 | for (p=(char *)reader[ridx].init_history; *p; p+=strlen(p)+1){
|
---|
| 968 | tpl_printf(vars, 1, "LOGHISTORY", "%s<BR>\n", p);
|
---|
| 969 | }
|
---|
| 970 | }
|
---|
[931] | 971 | #else
|
---|
[1019] | 972 | tpl_addVar(vars, 0, "LOGHISTORY", "The flag CS_RDR_INIT_HIST is not set in your binary<BR>\n");
|
---|
[931] | 973 | #endif
|
---|
[1019] | 974 | tpl_addVar(vars, 0, "READERNAME", reader_);
|
---|
[935] | 975 | }
|
---|
[1019] | 976 | fputs(tpl_getTpl(vars, "ENTITLEMENTS"), f);
|
---|
[928] | 977 | }
|
---|
| 978 |
|
---|
[1019] | 979 | void send_oscam_status(struct templatevars *vars, FILE *f) {
|
---|
| 980 | int i;
|
---|
[999] | 981 | char *usr;
|
---|
[935] | 982 | int lsec, isec, cnr, con, cau;
|
---|
[999] | 983 | time_t now = time((time_t)0);
|
---|
[935] | 984 | struct tm *lt;
|
---|
[1019] | 985 | for (i=0; i<CS_MAXPID; i++) {
|
---|
[1022] | 986 | if (client[i].pid) {
|
---|
[999] | 987 | if ((cfg->mon_hideclient_to <= 0) || (((now-client[i].lastecm)/60)<cfg->mon_hideclient_to) ||
|
---|
| 988 | (((now-client[i].lastemm)/60)<cfg->mon_hideclient_to) || (client[i].typ!='c')){
|
---|
[935] | 989 | lsec=now-client[i].login;
|
---|
| 990 | isec=now-client[i].last;
|
---|
| 991 | usr=client[i].usr;
|
---|
[1022] | 992 |
|
---|
[999] | 993 | if (((client[i].typ=='r') || (client[i].typ=='p')) && (con=cs_idx2ridx(i))>=0) usr=reader[con].label;
|
---|
[1022] | 994 |
|
---|
[999] | 995 | if (client[i].dup) con=2;
|
---|
[1019] | 996 | else if ((client[i].tosleep) && (now-client[i].lastswitch>client[i].tosleep)) con=1;
|
---|
[999] | 997 | else con=0;
|
---|
[1022] | 998 |
|
---|
[999] | 999 | if (i-cdiff>0) cnr=i-cdiff;
|
---|
| 1000 | else cnr=(i>1) ? i-1 : 0;
|
---|
[1022] | 1001 |
|
---|
[999] | 1002 | if( (cau=client[i].au+1) && (now-client[i].lastemm)/60 > cfg->mon_aulow) cau=-cau;
|
---|
[1022] | 1003 |
|
---|
[999] | 1004 | lt=localtime(&client[i].login);
|
---|
[1022] | 1005 |
|
---|
| 1006 | tpl_printf(vars, 0, "CLIENTPID", "%d", client[i].pid);
|
---|
[999] | 1007 | tpl_printf(vars, 0, "CLIENTTYPE", "%c", client[i].typ);
|
---|
| 1008 | tpl_printf(vars, 0, "CLIENTCNR", "%d", cnr);
|
---|
| 1009 | tpl_addVar(vars, 0, "CLIENTUSER", usr);
|
---|
| 1010 | tpl_printf(vars, 0, "CLIENTCAU", "%d", cau);
|
---|
| 1011 | tpl_printf(vars, 0, "CLIENTCRYPTED", "%d", client[i].crypted);
|
---|
| 1012 | tpl_printf(vars, 0, "CLIENTIP", "%s", cs_inet_ntoa(client[i].ip));
|
---|
| 1013 | tpl_printf(vars, 0, "CLIENTPORT", "%d", client[i].port);
|
---|
| 1014 | tpl_addVar(vars, 0, "CLIENTPROTO", monitor_get_proto(i));
|
---|
| 1015 | tpl_printf(vars, 0, "CLIENTLOGINDATE", "%02d.%02d.%02d", lt->tm_mday, lt->tm_mon+1, lt->tm_year%100);
|
---|
| 1016 | tpl_printf(vars, 0, "CLIENTLOGINTIME", "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec);
|
---|
| 1017 | tpl_printf(vars, 0, "CLIENTLOGINSECS", "%d", lsec);
|
---|
| 1018 | tpl_printf(vars, 0, "CLIENTCAID", "%04X", client[i].last_caid);
|
---|
| 1019 | tpl_printf(vars, 0, "CLIENTSRVID", "%04X", client[i].last_srvid);
|
---|
| 1020 | tpl_addVar(vars, 0, "CLIENTSRVNAME", monitor_get_srvname(client[i].last_srvid));
|
---|
| 1021 | tpl_printf(vars, 0, "CLIENTIDLESECS", "%d", isec);
|
---|
[1022] | 1022 | tpl_printf(vars, 0, "CLIENTCON", "%d", con);
|
---|
| 1023 | tpl_printf(vars, 0, "CWOK", "%d", client[i].cwfound);
|
---|
| 1024 | tpl_printf(vars, 0, "CWNOK", "%d", client[i].cwnot);
|
---|
[999] | 1025 | tpl_addVar(vars, 1, "CLIENTSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT"));
|
---|
| 1026 | }
|
---|
| 1027 | }
|
---|
[930] | 1028 | }
|
---|
| 1029 |
|
---|
[931] | 1030 | #ifdef CS_LOGHISTORY
|
---|
[930] | 1031 | for (i=(*loghistidx+3) % CS_MAXLOGHIST; i!=*loghistidx; i=(i+1) % CS_MAXLOGHIST){
|
---|
| 1032 | char *p_usr, *p_txt;
|
---|
| 1033 | p_usr=(char *)(loghist+(i*CS_LOGHISTSIZE));
|
---|
| 1034 | p_txt=p_usr+32;
|
---|
[999] | 1035 | if (p_txt[0]) tpl_printf(vars, 1, "LOGHISTORY", "%s<BR>\n", p_txt+8);
|
---|
[930] | 1036 | }
|
---|
[931] | 1037 | #else
|
---|
[999] | 1038 | tpl_addVar(vars, 0, "LOGHISTORY", "the flag CS_LOGHISTORY is not set in your binary<BR>\n");
|
---|
[931] | 1039 | #endif
|
---|
[999] | 1040 |
|
---|
| 1041 | fputs(tpl_getTpl(vars, "STATUS"), f);
|
---|
[930] | 1042 | }
|
---|
| 1043 |
|
---|
[1019] | 1044 | void send_oscam_services(struct templatevars *vars, FILE *f) {
|
---|
[945] | 1045 | struct s_sidtab *sidtab = cfg->sidtab;
|
---|
[1022] | 1046 | int i;
|
---|
[945] | 1047 |
|
---|
[1022] | 1048 | while(sidtab != NULL){
|
---|
[945] | 1049 | for (i=0; i<sidtab->num_caid; i++){
|
---|
[1019] | 1050 | if (i==0) tpl_printf(vars, 0, "CAIDS", "%04X", sidtab->caid[i]);
|
---|
| 1051 | else tpl_printf(vars, 1, "CAIDS", ",%04X", sidtab->caid[i]);
|
---|
[945] | 1052 | }
|
---|
| 1053 |
|
---|
| 1054 | for (i=0; i<sidtab->num_provid; i++){
|
---|
[1019] | 1055 | if (i==0) tpl_printf(vars, 0, "PROVIDS", "%ld08X", sidtab->provid[i]);
|
---|
| 1056 | else tpl_printf(vars, 1, "PROVIDS", ",%ld08X", sidtab->provid[i]);
|
---|
[945] | 1057 | }
|
---|
| 1058 |
|
---|
| 1059 | for (i=0; i<sidtab->num_srvid; i++){
|
---|
[1019] | 1060 | if (i==0) tpl_printf(vars, 0, "SRVIDS", "%04X", sidtab->srvid[i]);
|
---|
| 1061 | else tpl_printf(vars, 1, "SRVIDS", ",%04X", sidtab->srvid[i]);
|
---|
[945] | 1062 | }
|
---|
[1019] | 1063 | tpl_addVar(vars, 0, "LABEL", sidtab->label);
|
---|
| 1064 | tpl_printf(vars, 0, "CAIDNUM", "%d", sidtab->num_caid);
|
---|
| 1065 | tpl_printf(vars, 0, "PROVIDNUM", "%d",sidtab->num_provid);
|
---|
| 1066 | tpl_printf(vars, 0, "SRVIDNUM", "%d", sidtab->num_srvid);
|
---|
| 1067 | tpl_addVar(vars, 1, "SIDTABS", tpl_getTpl(vars, "SIDTABBIT"));
|
---|
| 1068 | sidtab=sidtab->next;
|
---|
[945] | 1069 | }
|
---|
[1019] | 1070 | fputs(tpl_getTpl(vars, "SIDTAB"), f);
|
---|
[945] | 1071 | }
|
---|
| 1072 |
|
---|
[1021] | 1073 | int process_request(FILE *f, struct in_addr in) {
|
---|
[928] | 1074 | char buf[4096];
|
---|
[937] | 1075 | char tmp[4096];
|
---|
[928] | 1076 |
|
---|
[960] | 1077 | int authok = 0;
|
---|
| 1078 | char expectednonce[64];
|
---|
| 1079 |
|
---|
[937] | 1080 | char *method;
|
---|
| 1081 | char *path;
|
---|
| 1082 | char *protocol;
|
---|
| 1083 | char *pch;
|
---|
| 1084 | char *pch2;
|
---|
[1019] | 1085 | /* List of possible pages */
|
---|
[935] | 1086 | char *pages[]={ "/config.html",
|
---|
[937] | 1087 | "/readers.html",
|
---|
| 1088 | "/entitlements.html",
|
---|
| 1089 | "/status.html",
|
---|
| 1090 | "/userconfig.html",
|
---|
[945] | 1091 | "/readerconfig.html",
|
---|
[965] | 1092 | "/services.html",
|
---|
[1019] | 1093 | "/user_edit.html",
|
---|
[965] | 1094 | "/site.css"};
|
---|
[999] | 1095 | int pagescnt = sizeof(pages)/sizeof(char *); // Calculate the amount of items in array
|
---|
[1022] | 1096 |
|
---|
[937] | 1097 | int pgidx = -1;
|
---|
| 1098 | int i;
|
---|
| 1099 | int parsemode = 1;
|
---|
[999] | 1100 | struct uriparams params;
|
---|
[1022] | 1101 | params.paramcount = 0;
|
---|
[935] | 1102 |
|
---|
[937] | 1103 | /* First line always includes the GET/POST request */
|
---|
| 1104 | if (!fgets(buf, sizeof(buf), f)) return -1;
|
---|
| 1105 | method = strtok(buf, " ");
|
---|
| 1106 | path = strtok(NULL, " ");
|
---|
| 1107 | protocol = strtok(NULL, "\r");
|
---|
| 1108 | if(method == NULL || path == NULL || protocol == NULL) return -1;
|
---|
[928] | 1109 |
|
---|
[937] | 1110 | pch=path;
|
---|
| 1111 | /* advance pointer to beginning of query string */
|
---|
| 1112 | while(pch[0] != '?' && pch[0] != '\0') ++pch;
|
---|
| 1113 | if(pch[0] == '?'){
|
---|
| 1114 | pch[0] = '\0';
|
---|
| 1115 | ++pch;
|
---|
| 1116 | }
|
---|
[935] | 1117 |
|
---|
[937] | 1118 | /* Map page to our static page definitions */
|
---|
| 1119 | for (i=0; i<pagescnt; i++){
|
---|
| 1120 | if (!strcmp(path, pages[i])) pgidx = i;
|
---|
| 1121 | }
|
---|
[928] | 1122 |
|
---|
[965] | 1123 | /* Parse url parameters; parsemode = 1 means parsing next param, parsemode = -1 parsing next
|
---|
[937] | 1124 | value; pch2 points to the beginning of the currently parsed string, pch is the current position */
|
---|
| 1125 | pch2=pch;
|
---|
| 1126 | while(pch[0] != '\0'){
|
---|
| 1127 | if((parsemode == 1 && pch[0] == '=') || (parsemode == -1 && pch[0] == '&')){
|
---|
| 1128 | pch[0] = '\0';
|
---|
| 1129 | urldecode(pch2);
|
---|
| 1130 | if(parsemode == 1) {
|
---|
[999] | 1131 | if(params.paramcount >= MAXGETPARAMS) break;
|
---|
| 1132 | ++params.paramcount;
|
---|
| 1133 | params.params[params.paramcount-1] = pch2;
|
---|
[937] | 1134 | } else {
|
---|
[999] | 1135 | params.values[params.paramcount-1] = pch2;
|
---|
[937] | 1136 | }
|
---|
| 1137 | parsemode = -parsemode;
|
---|
| 1138 | pch2 = pch + 1;
|
---|
[929] | 1139 | }
|
---|
[937] | 1140 | ++pch;
|
---|
| 1141 | }
|
---|
| 1142 | /* last value wasn't processed in the loop yet... */
|
---|
[999] | 1143 | if(parsemode == -1 && params.paramcount <= MAXGETPARAMS){
|
---|
[1019] | 1144 | urldecode(pch2);
|
---|
[999] | 1145 | params.values[params.paramcount-1] = pch2;
|
---|
[937] | 1146 | }
|
---|
[929] | 1147 |
|
---|
[965] | 1148 | if(strlen(cfg->http_user) == 0 || strlen(cfg->http_pwd) == 0) authok = 1;
|
---|
| 1149 | else calculate_nonce(expectednonce, sizeof(expectednonce)/sizeof(char));
|
---|
| 1150 |
|
---|
| 1151 | /* Read remaining request (we're only interested in auth header) */
|
---|
[937] | 1152 | while (fgets(tmp, sizeof(tmp), f)) {
|
---|
| 1153 | if (tmp[0] == '\r' && tmp[1] == '\n') break;
|
---|
[999] | 1154 | else if(authok == 0 && strlen(tmp) > 50 && strncmp(tmp, "Authorization:", 14) == 0 && strstr(tmp, "Digest") != NULL) {
|
---|
[965] | 1155 | authok = check_auth(tmp, method, path, expectednonce);
|
---|
[960] | 1156 | }
|
---|
[929] | 1157 | }
|
---|
| 1158 |
|
---|
[999] | 1159 | //cs_debug("%s %d\n", path, pgidx);
|
---|
| 1160 | //for(i=0; i < params.paramcount; ++i) cs_debug("%s : %s\n", params.params[i], params.values[i]);
|
---|
[937] | 1161 |
|
---|
[928] | 1162 | fseek(f, 0, SEEK_CUR); // Force change of stream direction
|
---|
| 1163 |
|
---|
[960] | 1164 | if(authok != 1){
|
---|
| 1165 | strcpy(tmp, "WWW-Authenticate: Digest algorithm=\"MD5\", realm=\"");
|
---|
| 1166 | strcat(tmp, AUTHREALM);
|
---|
| 1167 | strcat(tmp, "\", qop=\"auth\", opaque=\"\", nonce=\"");
|
---|
| 1168 | strcat(tmp, expectednonce);
|
---|
| 1169 | strcat(tmp, "\"");
|
---|
| 1170 | if(authok == 2) strcat(tmp, ", stale=true");
|
---|
| 1171 | send_headers(f, 401, "Unauthorized", tmp, "text/html");
|
---|
[1019] | 1172 | return 0;
|
---|
[960] | 1173 | }
|
---|
[928] | 1174 |
|
---|
[937] | 1175 | /*build page*/
|
---|
[929] | 1176 | send_headers(f, 200, "OK", NULL, "text/html");
|
---|
[1019] | 1177 | if(pgidx == 8) send_css(f);
|
---|
| 1178 | else if(pgidx != 0){
|
---|
[999] | 1179 | time_t t;
|
---|
| 1180 | struct templatevars *vars = tpl_create();
|
---|
| 1181 | struct tm *lt;
|
---|
| 1182 | time(&t);
|
---|
[1022] | 1183 |
|
---|
| 1184 | lt=localtime(&t);
|
---|
[999] | 1185 | tpl_addVar(vars, 0, "CS_VERSION", CS_VERSION);
|
---|
| 1186 | tpl_addVar(vars, 0, "CS_SVN_VERSION", CS_SVN_VERSION);
|
---|
[1019] | 1187 | if(cfg->http_refresh > 0 && (pgidx == 3 || pgidx == -1)){
|
---|
[999] | 1188 | tpl_printf(vars, 0, "REFRESHTIME", "%d", cfg->http_refresh);
|
---|
[1019] | 1189 | tpl_addVar(vars, 0, "REFRESH", tpl_getTpl(vars, "REFRESH"));
|
---|
| 1190 | }
|
---|
[999] | 1191 | tpl_printf(vars, 0, "CURDATE", "%02d.%02d.%02d", lt->tm_mday, lt->tm_mon+1, lt->tm_year%100);
|
---|
| 1192 | tpl_printf(vars, 0, "CURTIME", "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec);
|
---|
[1019] | 1193 | switch(pgidx){
|
---|
| 1194 | case 0: break;
|
---|
| 1195 | case 1: send_oscam_reader(vars, f); break;
|
---|
| 1196 | case 2: send_oscam_entitlement(vars, f, ¶ms); break;
|
---|
| 1197 | case 3: send_oscam_status(vars, f); break;
|
---|
| 1198 | case 4: send_oscam_user_config(vars, f, ¶ms); break;
|
---|
| 1199 | case 5: send_oscam_reader_config(vars, f, ¶ms); break;
|
---|
| 1200 | case 6: send_oscam_services(vars, f); break;
|
---|
| 1201 | case 7: send_oscam_user_config_edit(vars, f, ¶ms); break;
|
---|
| 1202 | default: send_oscam_status(vars, f); break;
|
---|
| 1203 | }
|
---|
[999] | 1204 | tpl_clear(vars);
|
---|
| 1205 | } else {
|
---|
[1019] | 1206 | send_htmlhead(f,0);
|
---|
[929] | 1207 | send_oscam_menu(f);
|
---|
[1019] | 1208 | send_oscam_config(f, ¶ms);
|
---|
[929] | 1209 | send_footer(f);
|
---|
| 1210 | fprintf(f, "</BODY></HTML>\r\n");
|
---|
[965] | 1211 | }
|
---|
[929] | 1212 | return 0;
|
---|
[928] | 1213 | }
|
---|
| 1214 |
|
---|
[935] | 1215 | void http_srv() {
|
---|
[1023] | 1216 | int i,sock, reuse =1;
|
---|
[935] | 1217 | struct sockaddr_in sin;
|
---|
[1021] | 1218 | struct sockaddr_in remote;
|
---|
[1023] | 1219 | socklen_t len = sizeof(remote);
|
---|
[960] | 1220 | char *tmp;
|
---|
| 1221 |
|
---|
| 1222 | /* Prepare lookup array for conversion between ascii and hex */
|
---|
| 1223 | tmp = malloc(3*sizeof(char));
|
---|
[980] | 1224 | for(i=0; i<256; i++) {
|
---|
| 1225 | snprintf(tmp, 3,"%02x", i);
|
---|
| 1226 | memcpy(hex2ascii[i], tmp, 2);
|
---|
| 1227 | }
|
---|
[965] | 1228 | free(tmp);
|
---|
[980] | 1229 | /* Create random string for nonce value generation */
|
---|
| 1230 | srand(time(NULL));
|
---|
| 1231 | create_rand_str(noncekey,32);
|
---|
[960] | 1232 |
|
---|
| 1233 | /* Startup server */
|
---|
[1021] | 1234 | if((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0){
|
---|
[980] | 1235 | cs_log("HTTP Server: Creating socket failed! (errno=%d)", errno);
|
---|
| 1236 | return;
|
---|
| 1237 | }
|
---|
[1023] | 1238 | if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0){
|
---|
| 1239 | cs_log("HTTP Server: Setting SO_REUSEADDR via setsockopt failed! (errno=%d)", errno);
|
---|
| 1240 | }
|
---|
| 1241 |
|
---|
[1021] | 1242 | memset(&sin, 0, sizeof sin);
|
---|
[935] | 1243 | sin.sin_family = AF_INET;
|
---|
| 1244 | sin.sin_addr.s_addr = INADDR_ANY;
|
---|
| 1245 | sin.sin_port = htons(cfg->http_port);
|
---|
[980] | 1246 | if((bind(sock, (struct sockaddr *) &sin, sizeof(sin))) < 0) {
|
---|
| 1247 | cs_log("HTTP Server couldn't bind on port %d (errno=%d). Not starting HTTP!", cfg->http_port, errno);
|
---|
| 1248 | close(sock);
|
---|
| 1249 | return;
|
---|
| 1250 | }
|
---|
[1023] | 1251 | if (listen(sock, SOMAXCONN) < 0){
|
---|
[980] | 1252 | cs_log("HTTP Server: Call to listen() failed! (errno=%d)", errno);
|
---|
| 1253 | close(sock);
|
---|
| 1254 | return;
|
---|
| 1255 | }
|
---|
[935] | 1256 | cs_log("HTTP Server listening on port %d", cfg->http_port);
|
---|
| 1257 | while (1)
|
---|
| 1258 | {
|
---|
| 1259 | int s;
|
---|
| 1260 | FILE *f;
|
---|
[1021] | 1261 | if((s = accept(sock, (struct sockaddr *) &remote, &len)) < 0){
|
---|
[980] | 1262 | cs_log("HTTP Server: Error calling accept() (errno=%d).", errno);
|
---|
| 1263 | break;
|
---|
| 1264 | }
|
---|
[928] | 1265 |
|
---|
[935] | 1266 | f = fdopen(s, "r+");
|
---|
[1021] | 1267 | process_request(f, remote.sin_addr);
|
---|
[960] | 1268 | fflush(f);
|
---|
[935] | 1269 | fclose(f);
|
---|
[1023] | 1270 | shutdown(s, SHUT_WR);
|
---|
[967] | 1271 | close(s);
|
---|
[928] | 1272 | }
|
---|
| 1273 | close(sock);
|
---|
| 1274 | }
|
---|