English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Diff of /branches/common-nfo/package/davfs2/fwwif/davfs2.ecpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3426 by tg, Wed Jul 18 12:45:43 2007 UTC revision 3427 by tg, Wed Aug 8 11:08:41 2007 UTC
# Line 2  Line 2 
2   # The FreeWRT Webinterface   # The FreeWRT Webinterface
3   #-   #-
4   # Copyright © 2007   # Copyright © 2007
5   #      Thorsten Glaser <tg@mirbsd.de>   #      Thorsten Glaser <tg@aurisp.de>
6   #   #
7   # Provided that these terms and disclaimer and all copyright notices   # Provided that these terms and disclaimer and all copyright notices
8   # are retained or reproduced in an accompanying document, permission   # are retained or reproduced in an accompanying document, permission
# Line 33  __RCSID("$Id$"); Line 33  __RCSID("$Id$");
33  index = "change <a href=\"davfs2/davfs2\">davfs2 account</a> data";  index = "change <a href=\"davfs2/davfs2\">davfs2 account</a> data";
34  </%attr>  </%attr>
35  <%args>  <%args>
36    servr;
37  uname;  uname;
38  passw;  passw;
39  really;  really;
40  </%args>  </%args>
41  <%cpp>  <%cpp>
42          runComp2(header@fwwif, title, "davfs2 account data");          runComp2(header@fwwif, title, "davfs2 account data");
43          if (really == "yes") {          if (really == "yes" && servr != "") {
44                  FILE *f;                  FILE *f;
45    
46                  if ((f = fopen("/etc/davfs2/secrets", "wb")) != NULL) {                  if ((f = fopen("/etc/davfs2/secrets", "wb")) != NULL) {
47                          fprintf(f, "%s\t\"%s\"\t\"%s\"\n",                          fprintf(f, "%s\t\"%s\"\t\"%s\"\n",
48                              "https://mediacenter.gmx.net",                              servr.c_str(), uname.c_str(), passw.c_str());
                             uname.c_str(), passw.c_str());  
49                          fclose(f);                          fclose(f);
50                  }                  }
51          }          }
52          char *result, *cp;          char *result, *cp;
53          int i;          int i;
54            servr = "";
55          uname = "";          uname = "";
56          passw = "";          passw = "";
57          result = c_exec("/bin/mksh -c 'while read line; do"          result = c_exec("/bin/mksh -c 'while read line; do"
58              "   line=${line%%#*};"              "   line=${line%%#*};"
59              "   [[ $line = *([   ]) ]] && continue;"              "   [[ $line = *([   ]) ]] && continue;"
60              "   set -A x $line;"              "   set -A x $line;"
61              "   print -r -- \"${x[1]}   ${x[2]}\";"              "   print -r -- \"${x[0]}   ${x[1]} ${x[2]}\" | tr -d \\\";"
62              "   break;"              "   break;"
63              "done </etc/davfs2/secrets'", &i);              "done </etc/davfs2/secrets'", &i);
64          if (result && (cp = strchr(result, '\t'))) {          if (result && (cp = strchr(result, '\t'))) {
                 if (*result == '"' && cp[-1] == '"') {  
                         result++;  
                         cp[-1] = '\0';  
                 }  
65                  *cp++ = '\0';                  *cp++ = '\0';
66                  if (*cp == '"') {                  servr = result;
67                          char *cp2 = cp;                  if ((cp = strchr((result = cp), '\t'))) {
68                            if (*result == '"' && cp[-1] == '"') {
69                                    result++;
70                                    cp[-1] = '\0';
71                            }
72                            *cp++ = '\0';
73                            if (*cp == '"') {
74                                    char *cp2;
75    
76                          while (*cp2)                                  cp2 = cp + strlen(cp) - 1;
77                                  ++cp2;                                  if (*cp2 == '"') {
78                          if (*--cp2 == '"') {                                          cp++;
79                                  cp++;                                          *cp2 = '\0';
80                                  *cp2 = '\0';                                  }
81                          }                          }
82                            uname = result;
83                            passw = cp;
84                  }                  }
                 uname = result;  
                 passw = cp;  
85          }          }
86  </%cpp>  </%cpp>
87  <h1>Change davfs2 account data</h1>  <h1>Change davfs2 account data</h1>
88  <form action="davfs2?really=yes" method="post"><table>  <form action="davfs2?really=yes" method="post"><table>
89   <tr>   <tr>
90      <td>Server (complete URI)</td>
91      <td><input type="text" name="servr" value="<$servr$>" /></td>
92     </tr><tr>
93    <td>Username</td>    <td>Username</td>
94    <td><input type="text" name="uname" value="<$uname$>" /></td>    <td><input type="text" name="uname" value="<$uname$>" /></td>
95   </tr><tr>   </tr><tr>

Legend:
Removed from v.3426  
changed lines
  Added in v.3427

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20