Skip to content

Commit

Permalink
updated iwebadmin
Browse files Browse the repository at this point in the history
1. created mod_user1.html, mod_user2.html for scram, non-scram setup
2. user.c: fix search by index
3. user.c: use mod_user1.html, mod_user2.html for scram, non-scram setup
  • Loading branch information
mbhangui committed Jun 2, 2024
1 parent d6c8403 commit 31bd7f9
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 39 deletions.
4 changes: 4 additions & 0 deletions iwebadmin-x/doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Release @version@-@release@ Start 28/07/2023 End 24/05/2024
18. iwebadmin.spec, debian/*.dsc.in: updated indimail, indimail-devel minimum
version requirement
19. command.c: corrected defines used for role based access
- 02/06/2024
20. created mod_user1.html, mod_user2.html for scram, non-scram setup
21. user.c: fix search by index
22. user.c: use mod_user1.html, mod_user2.html for scram, non-scram setup

* Tue Jan 31 2023 03:34:39 +0000 Manvendra Bhangui <iwebadmin@indimail.org> 2.1.1-1.1%{?dist}
Release 2.1.1-1.1 Start 14/09/2022 End 31/01/2023
Expand Down
File renamed without changes.
163 changes: 163 additions & 0 deletions iwebadmin-x/html/mod_user2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
</head>
<body bgcolor="#ffffff" onload="init();">

<script language="Javascript" type="text/javascript">
</script>

<script type="text/javascript">
</script>

<center>
<!-- Black frame 2 pixels wide -->
<table cellpadding="2" cellspacing="0" border="0" align="center" width="600" bgcolor="#000000"><tr><td>
<!-- Frame content -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" bgcolor="#ffffff">
<!-- Form title -->
<tr>
<td bgcolor="#000000" align="center">
<font color="#ffffff" size="3">
<b>##X109: ##A@##D</b>
</font>
</td>
</tr>
<!-- End of form title -->
<!-- Form content -->
<tr>
<td>
<table cellpadding="5" cellspacing="1" border="0" width="100%">
<!-- Form fields -->
<tr>
<td>
<form method="post" name="logon" action="##C/com/modusernow?##&">
<input type="hidden" name="modu" value="##A">
<table cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="right">##X092:</td>
<td align="left"><input type="text" name="gecos" maxlength="128" size="32" value="##i7"></td>
</tr>
<tr>
<td align="right">##X110:</td>
<td align="left"><input type="password" name="password1" maxlength=128 size=16></td>
</tr>
<tr>
<td align="right">##X091</td>
<td align="left"><input type="password" name="password2" maxlength=128 size=16></td>
</tr>
<tr>
<td align="right">##X022</td>
<td align="left"><input type="checkbox" name="cram" ##J0>&nbsp;##X023</td>
</tr>
<tr>
<td align="right">##X027:</td>
<td align="left"><input type="text" name="b64salt" maxlength="64" size="20" value="##m3"></td>
</tr>
##tq <tr>
<td align="right">##X249:</td>
<td align="left">
##ta
<input type="text" name="quota" maxlength="24" size="5" value="##q">
&nbsp;##X251
##tt
##tu ##Q ##q ##tt
</td>
</tr>
##tt
</table><HR>
<table cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="right" valign="top">##X260:</td>
<td align="left">
<input type="radio" name="cforward"
onClick="document.forms[0].nforward.disabled=true;
document.forms[0].fsaved.disabled=true;"
value="disable" ##i0> ##X205
<HR>
<input type="radio" name="cforward"
onClick="document.forms[0].nforward.disabled=true;
document.forms[0].fsaved.disabled=true;"
value="blackhole" ##i8> ##X303
<HR>
<input type="radio" name="cforward"
onClick="document.forms[0].nforward.disabled=false;
document.forms[0].fsaved.disabled=false;
document.forms[0].nforward.select()
document.forms[0].nforward.focus()"
value="forward" ##i1>&nbsp;##X211&nbsp;<input type="text" size="35" name="nforward"
value="##i2"><BR>
&nbsp; &nbsp; <input type="checkbox" name="fsaved" ##i3> ##X210&nbsp;
</td>
</tr>
</table><HR>
<input type="checkbox" name="autoresp"
onClick="document.forms[0].vsubject.select()
document.forms[0].vsubject.focus()"
value="on" ##i4> ##X212<BR>
##X213&nbsp;<input type="text" name="vsubject" size="50" value="##i5">
<BR>##X214&nbsp;<BR>
<textarea name="vmessage" rows="10" cols="60">##i6</textarea>
<HR>
<table cellpadding="1" cellspacing="1" border="0">

<!-- user mailbox flags
user mailbox flags -->
<tr>
<td align=right valign=top>##X296:</td>
<td align="left">
##X299:
<input type="radio" name="zeroflag" value="on" ##J1>##X297
&nbsp; &nbsp;
<input type="radio" name="zeroflag" value="off" ##J2>##X298
<BR>
##X300:
<input type="radio" name="oneflag" value="on" ##J3>##X297
&nbsp; &nbsp;
<input type="radio" name="oneflag" value="off" ##J4>##X298
<BR>
##X301:
<input type="radio" name="twoflag" value="on" ##J5>##X297
&nbsp; &nbsp;
<input type="radio" name="twoflag" value="off" ##J6>##X298
<BR>
##X302:
<input type="radio" name="threeflag" value="on" ##J7>##X297
&nbsp; &nbsp;
<input type="radio" name="threeflag" value="off" ##J8>##X298
</td>
</tr>

<tr>
<td colspan=2 align=right>
<input type="submit" value="##X111">
</td>
</tr>
</table>
</form>

<script type="text/javascript">
</script>
</td>
</tr>
</table>
<div align="right">
<hr>
<font size="2"><b>
[&nbsp;
##ta
<a href="##C/com/showusers?##&">##X061</a>
&nbsp;|&nbsp;
<a href="##C/com/showmenu?##&">##X001</a>
&nbsp;|&nbsp;
##tt
##x
&nbsp;]
</b></font>
</div>
</td>
</tr>
<!-- End of form fields -->
</table>
<!-- End of frame content -->
</td></tr></table>
<!-- End of black frame -->
<h2>##S</h2>
</center>
5 changes: 3 additions & 2 deletions iwebadmin-x/iwebadmin.spec.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
#
# $Id: iwebadmin.spec.in,v 1.54 2024-05-31 15:51:12+05:30 Cprogrammer Exp mbhangui $
# $Id: iwebadmin.spec.in,v 1.55 2024-06-02 18:54:07+05:30 Cprogrammer Exp mbhangui $
%undefine _missing_build_ids_terminate_build
%define _unpackaged_files_terminate_build 1

Expand Down Expand Up @@ -191,7 +191,8 @@ find %{buildroot}%{mandir} -type f -exec gzip -q {} \;
%attr(444,root,root) @htmllibdir@/html/mod_autorespond.html
%attr(444,root,root) @htmllibdir@/html/mod_dotqmail.html
%attr(444,root,root) @htmllibdir@/html/mod_mailinglist-idx.html
%attr(444,root,root) @htmllibdir@/html/mod_user.html
%attr(444,root,root) @htmllibdir@/html/mod_user1.html
%attr(444,root,root) @htmllibdir@/html/mod_user2.html
%attr(444,root,root) @htmllibdir@/html/setremotecatchall.html
%attr(444,root,root) @htmllibdir@/html/show_autorespond.html
%attr(444,root,root) @htmllibdir@/html/show_digest_subscribers.html
Expand Down
6 changes: 1 addition & 5 deletions iwebadmin-x/template.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: template.c,v 1.34 2024-05-30 23:03:24+05:30 Cprogrammer Exp mbhangui $
* $Id: template.c,v 1.35 2024-06-02 18:54:31+05:30 Cprogrammer Exp mbhangui $
* Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -509,8 +509,6 @@ send_template_now(const char *filename)
case '1':
if (scram == 1 || scram == 2)
printh("%d", iter_count);
else
printh("%H", "XXXX");
break;
case '2':
if (scram == 0)
Expand All @@ -521,8 +519,6 @@ send_template_now(const char *filename)
else
if (scram == 2)
printh("%H", "scram-sha-256");
else
printh("%H", "not set");
break;
case '3':
printh("%H", b64salt.len ? b64salt.s : "");
Expand Down
77 changes: 45 additions & 32 deletions iwebadmin-x/user.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: user.c,v 1.39 2024-05-30 23:05:16+05:30 Cprogrammer Exp mbhangui $
* $Id: user.c,v 1.40 2024-06-02 18:54:55+05:30 Cprogrammer Exp mbhangui $
* Copyright (C) 1999-2004 Inter7 Internet Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -96,7 +96,7 @@ show_users()
int
show_user_lines(const char *user, const char *dom, time_t mytime, const char *dir)
{
int fd, i, k, startnumber, moreusers = 1, totalpages,
int fd, i, k, skip_user_count, moreusers = 1, totalpages,
bounced, colspan = 7, allowdelete, bars, match;
struct passwd *pw;
char qconvert[FMT_DOUBLE], strnum[FMT_ULONG];
Expand Down Expand Up @@ -139,10 +139,31 @@ show_user_lines(const char *user, const char *dom, time_t mytime, const char *di
}
close(fd);

if (str_str(line.s, " bounce-no-mailbox\n"))
bounced = 1;
else
if (str_str(line.s, "@")) {
bounced = 0;
i = str_rchr(line.s, ' ');
if (line.s[i] == ' ') {
if (!stralloc_copyb(&dest, line.s + i + 1, line.len - (i + 1)) ||
!stralloc_0(&dest))
die_nomem();
dest.len--;
}
} else {
/*- Maildir type catchall */
bounced = 0;
if (!stralloc_copy(&dest, &line) ||
!stralloc_0(&dest))
die_nomem();
dest.len--;
}

if (SearchUser.len) {
pw = sql_getall(dom, 1, 1);
for (k = 0; pw; k++) {
if ((!SearchUser.s[1] && pw->pw_name[0] >= SearchUser.s[0]) || !str_diff(SearchUser.s, pw->pw_name))
if ((!SearchUser.s[1] && pw->pw_name[0] >= SearchUser.s[0]) || !str_diffn(SearchUser.s, pw->pw_name, SearchUser.len))
break;
pw = sql_getall(dom, 0, 0);
}
Expand All @@ -152,53 +173,40 @@ show_user_lines(const char *user, const char *dom, time_t mytime, const char *di
Pagenumber[fmt_int(Pagenumber, (k / MAXUSERSPERPAGE) + 1)] = 0;
}

/*- Determine number of pages */
if (!stralloc_copyb(&TmpBuf, "where pw_domain=\"", 17) ||
!stralloc_cats(&TmpBuf, dom) ||
!stralloc_append(&TmpBuf, "\"") ||
!stralloc_0(&TmpBuf))
die_nomem();
k = count_table("indimail", TmpBuf.s) + count_table("indibak", TmpBuf.s);
/*- Determine number of pages */
if (k == 0)
totalpages = 1;
else
totalpages = (k / MAXUSERSPERPAGE) + 1;
scan_int(*Pagenumber ? Pagenumber : "1", &i);
startnumber = MAXUSERSPERPAGE * (i - 1);
/* start one page before */
skip_user_count = MAXUSERSPERPAGE * (i - 1);
if (i == 0)
str_copy(Pagenumber, "1");
if (str_str(line.s, " bounce-no-mailbox\n"))
bounced = 1;
else
if (str_str(line.s, "@")) {
bounced = 0;
i = str_rchr(line.s, ' ');
if (line.s[i] == ' ') {
if (!stralloc_copyb(&dest, line.s + i + 1, line.len - (i + 1)) ||
!stralloc_0(&dest))
die_nomem();
dest.len--;
}
} else {
/*- Maildir type catchall */
bounced = 0;
if (!stralloc_copy(&dest, &line) ||
!stralloc_0(&dest))
die_nomem();
dest.len--;
}

/*
/*-
* check to see if there are any users to list,
* otherwise repeat previous page
*/
pw = sql_getall(dom, 1, 1);
if (AdminType == DOMAIN_ADMIN || (AdminType == USER_ADMIN && !str_diffn(pw->pw_name, Username.s, Username.len + 1))) {
for (k = 0; k < startnumber; ++k) {
if (AdminType == DOMAIN_ADMIN) {
for (k = 0; pw; k++) {
if (SearchUser.len) {
if ((!SearchUser.s[1] && pw->pw_name[0] >= SearchUser.s[0]) || !str_diffn(SearchUser.s, pw->pw_name, SearchUser.len))
break;
} else
if (k >= skip_user_count)
break;
pw = sql_getall(dom, 0, 0);
}
}
if (pw == NULL) {
if (!pw) {
out("<tr><td colspan=\"");
strnum[fmt_int(strnum, colspan)] = 0;
out(strnum);
Expand All @@ -211,8 +219,9 @@ show_user_lines(const char *user, const char *dom, time_t mytime, const char *di
flush();
} else {
while (pw &&
((k < MAXUSERSPERPAGE + startnumber) ||
(AdminType != DOMAIN_ADMIN || (AdminType == USER_ADMIN && !str_diffn(pw->pw_name, Username.s, Username.len + 1)))))
(k < (MAXUSERSPERPAGE + skip_user_count) ||
(AdminType != DOMAIN_ADMIN ||
(AdminType == USER_ADMIN && !str_diffn(pw->pw_name, Username.s, Username.len + 1)))))
{
if (AdminType == DOMAIN_ADMIN || (AdminType == USER_ADMIN && !str_diffn(pw->pw_name, Username.s, Username.len + 1))) {
mdir_t diskquota = 0;
Expand Down Expand Up @@ -398,7 +407,7 @@ moduser()
iclose();
iweb_exit(PERM_FAILURE);
}
send_template("mod_user.html");
send_template(scram != -1 ? "mod_user1.html" : "mod_user2.html");
}

void
Expand Down Expand Up @@ -1864,6 +1873,10 @@ parse_users_dotqmail(char newchar)

/*-
* $Log: user.c,v $
* Revision 1.40 2024-06-02 18:54:55+05:30 Cprogrammer
* fix search by index
* use mod_user1.html, mod_user2.html for scram, non-scram setup
*
* Revision 1.39 2024-05-30 23:05:16+05:30 Cprogrammer
* removed limits.c, limits.h
*
Expand Down

0 comments on commit 31bd7f9

Please sign in to comment.