split() matching regular expression question - openwebmail bug...

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default split() matching regular expression question - openwebmail bug...

    Openwebmail seems to have a bug in the way it stores and retrieves data,
    especially passwords from a file called .pop3book.

    In .pop3book there are stored entries for host,port,user,pass,etc.. They
    are delimited by @@@.

    Here's the line with the problem in openwebmail-main.pl:

    my ($pop3host,$pop3port, $pop3user,$pop3passwd, $pop3del,
    $enable)=split(/\@\@\@/,$_);

    If the user's password ends in a '@' character, the split() causes the @
    to be cut off the $pop3passwd and added to the $pop3del variable.

    Any way to fix this with a better matching regular expression in the
    call to split ?

    Otherwise, it seems I have to rewrite every part of openwebmail that
    uses the @@@ delimiter and change it to some more sensible (less likely
    to conflict with passwords) delimiter. That also would mean changing all
    ..pop3book files on the server, which isn't a good thing either..

    Thanks for any ideas,
    Ken A.



    Ken A Guest

  2. Similar Questions and Discussions

    1. Regular Expression Question
      Hello, is it possible to make a regular expression match for the following situation: I have a string, looking like 'foobarbarbar'. I don't...
    2. Regular expression newbie question
      How do I write "not" in regular expression? I am new to reg exp. I want to check the string which does not contain "http://" I wrote ...
    3. backtracking in regular expression matching
      Hi, For the pattern "(((.*)cd)*)*cdcd" and string "ababcdcdcdef", can anyone tell me the detail meachanism of backtracking? This regular...
    4. Regular Expression Matching
      Hello, I am trying to figure out how to match a an email w/in a delimited line. ie: 1, 'John', 'Doe', 'I', 'john.doe@domain.ext' the list...
    5. [PHP] Regular expression question
      well, first off '>' should not be allowed as a value of an attr="" pair anyways. You should convert it to > or < this will solve that problem....
  3. #2

    Default Re: split() matching regular expression question - openwebmail bug...

    X-Ftn-To: Ken A

    Ken A <ken@pacific.net> wrote:
    >my ($pop3host,$pop3port, $pop3user,$pop3passwd, $pop3del,
    >$enable)=split(/\@\@\@/,$_);
    >
    >If the user's password ends in a '@' character, the split() causes the @
    >to be cut off the $pop3passwd and added to the $pop3del variable.
    >
    >Any way to fix this with a better matching regular expression in the
    >call to split ?
    >
    >Otherwise, it seems I have to rewrite every part of openwebmail that
    >uses the @@@ delimiter and change it to some more sensible (less likely
    >to conflict with passwords) delimiter. That also would mean changing all
    >.pop3book files on the server, which isn't a good thing either..
    >
    >Thanks for any ideas,
    You could reverse $_ but then you're vulnerable if some field begins with
    '@' :)


    --
    Matija
    Matija Papec Guest

  4. #3

    Default Re: split() matching regular expression question - openwebmail bug...

    Ken A <ken@pacific.net> wrote:
    [...]
    > Here's the line with the problem in openwebmail-main.pl:
    >
    > my ($pop3host,$pop3port, $pop3user,$pop3passwd, $pop3del,
    > $enable)=split(/\@\@\@/,$_);
    >
    > If the user's password ends in a '@' character, the split() causes the @
    > to be cut off the $pop3passwd and added to the $pop3del variable.
    Change the RE to check that the character after the third @ is not an @:
    $str = 'f1@@@f2@@@pass@@@@f4';
    @fields = split/\@{3}(?=[^@]|$)/, $str;


    --
    Glenn Jackman
    NCF Sysadmin
    [email]glennj@ncf.ca[/email]
    Glenn Jackman Guest

  5. #4

    Default Re: split() matching regular expression question - openwebmail bug...

    Ken A <ken@pacific.net> wrote:
    [...]
    > Here's the line with the problem in openwebmail-main.pl:
    >
    > my ($pop3host,$pop3port, $pop3user,$pop3passwd, $pop3del,
    > $enable)=split(/\@\@\@/,$_);
    >
    > If the user's password ends in a '@' character, the split() causes the @
    > to be cut off the $pop3passwd and added to the $pop3del variable.
    Change the RE to check that the character after the third @ is not an @:
    $str = 'f1@@@f2@@@pass@@@@f4';
    @fields = split /\@{3}(?!@)/, $str;


    --
    Glenn Jackman
    NCF Sysadmin
    [email]glennj@ncf.ca[/email]
    Glenn Jackman Guest

  6. #5

    Default Re: split() matching regular expression question - openwebmail bug...

    In article <vm1iqi4pcfed5a@corp.supernews.com>, Ken A wrote:
    > Openwebmail seems to have a bug in the way it stores and retrieves data,
    > especially passwords from a file called .pop3book.
    >
    > In .pop3book there are stored entries for host,port,user,pass,etc.. They
    > are delimited by @@@.
    >
    > Here's the line with the problem in openwebmail-main.pl:
    >
    > my ($pop3host,$pop3port, $pop3user,$pop3passwd, $pop3del,
    > $enable)=split(/\@\@\@/,$_);
    >
    > If the user's password ends in a '@' character, the split() causes the @
    > to be cut off the $pop3passwd and added to the $pop3del variable.
    [cut]

    IMHO, the best way to fix this is to store the passwords
    encrypted, just like the passwords in /etc/passwd on a Unix
    system. Use a cipher that does not generate '@' characters.

    If that's too involved, store them as strings consisting of the
    3-digit ASCII codes, or something.

    If that's too involved, change the regex to /@@@(?=[^@])/, but
    this assumes that $pop3del won't ever start with '@'. Look for
    "zero-width positive look-ahead assertion" in the perlre manual.


    Cheers,
    Andreas


    --
    Andreas Kähäri
    Andreas Kahari Guest

  7. #6

    Default Re: split() matching regular expression question - openwebmail bug...


    "Ken A" <ken@pacific.net> wrote in message
    news:vm1iqi4pcfed5a@corp.supernews.com...
    > Openwebmail seems to have a bug in the way it stores and retrieves data,
    > especially passwords from a file called .pop3book.
    >
    > In .pop3book there are stored entries for host,port,user,pass,etc.. They
    > are delimited by @@@.
    >
    > Here's the line with the problem in openwebmail-main.pl:
    >
    > my ($pop3host,$pop3port, $pop3user,$pop3passwd, $pop3del,
    > $enable)=split(/\@\@\@/,$_);
    >
    > If the user's password ends in a '@' character, the split() causes the @
    > to be cut off the $pop3passwd and added to the $pop3del variable.
    >
    > Any way to fix this with a better matching regular expression in the
    > call to split ?
    >
    > Otherwise, it seems I have to rewrite every part of openwebmail that
    > uses the @@@ delimiter and change it to some more sensible (less likely
    > to conflict with passwords) delimiter. That also would mean changing all
    > .pop3book files on the server, which isn't a good thing either..
    >
    > Thanks for any ideas,
    > Ken A.
    >
    >
    >
    You could also use \t (tab) as a delimiter. I use it myself often, without
    any problems.

    Bart


    Bart van den Burg Guest

  8. #7

    Default Re: split() matching regular expression question - openwebmail bug...

    In article <bjqm07$5ic$1@reader11.wxs.nl>, Bart van den Burg wrote:
    >
    > "Ken A" <ken@pacific.net> wrote in message
    > news:vm1iqi4pcfed5a@corp.supernews.com...
    [cut]
    >> If the user's password ends in a '@' character, the split() causes the @
    >> to be cut off the $pop3passwd and added to the $pop3del variable.
    >>
    >> Any way to fix this with a better matching regular expression in the
    >> call to split ?
    [cut]
    >
    > You could also use \t (tab) as a delimiter. I use it myself often, without
    > any problems.
    What if I decide to use a tab at the end of my password?
    (assuming it still makes a valid password) You've just replaced
    the trouble character with another trouble character.


    --
    Andreas Kähäri
    Andreas Kahari Guest

  9. #8

    Default Re: split() matching regular expression question - openwebmail bug...


    "Andreas Kahari" <ak+usenet@freeshell.org> wrote in message
    news:slrnbm1n7j.ncd.ak+usenet@vinland.freeshell.or g...
    > In article <bjqm07$5ic$1@reader11.wxs.nl>, Bart van den Burg wrote:
    > >
    > > "Ken A" <ken@pacific.net> wrote in message
    > > news:vm1iqi4pcfed5a@corp.supernews.com...
    > [cut]
    > >> If the user's password ends in a '@' character, the split() causes the
    @
    > >> to be cut off the $pop3passwd and added to the $pop3del variable.
    > >>
    > >> Any way to fix this with a better matching regular expression in the
    > >> call to split ?
    > [cut]
    > >
    > > You could also use \t (tab) as a delimiter. I use it myself often,
    without
    > > any problems.
    >
    > What if I decide to use a tab at the end of my password?
    > (assuming it still makes a valid password) You've just replaced
    > the trouble character with another trouble character.
    Because that's hard to do if it's in a web environment, cause if you press
    [tab], you'll go to the next input box. Ok, you could go and copy/paste one,
    but would you really wanna do that everytime you wanna login there?

    Bart


    Bart van den Burg Guest

  10. #9

    Default Re: split() matching regular expression question - openwebmail bug...

    In article <bjqmsu$6nd$1@reader11.wxs.nl>, Bart van den Burg wrote:
    >
    > "Andreas Kahari" <ak+usenet@freeshell.org> wrote in message
    > news:slrnbm1n7j.ncd.ak+usenet@vinland.freeshell.or g...
    >> In article <bjqm07$5ic$1@reader11.wxs.nl>, Bart van den Burg wrote:
    >> >
    >> > "Ken A" <ken@pacific.net> wrote in message
    >> > news:vm1iqi4pcfed5a@corp.supernews.com...
    >> [cut]
    >> >> If the user's password ends in a '@' character, the split() causes the
    [cut]
    >> >> Any way to fix this with a better matching regular expression in the
    >> >> call to split ?
    [cut]
    >> > You could also use \t (tab) as a delimiter. I use it myself often,
    > without
    >> > any problems.
    >>
    >> What if I decide to use a tab at the end of my password?
    >> (assuming it still makes a valid password) You've just replaced
    >> the trouble character with another trouble character.
    >
    > Because that's hard to do if it's in a web environment, cause if you press
    > [tab], you'll go to the next input box. Ok, you could go and copy/paste one,
    > but would you really wanna do that everytime you wanna login there?
    Point taken, kinda'. Are you sure it's not as simple as typing
    <shift><tab> or something similar in one browser or another?

    My point is that you should try to come up with a solid solution
    to the problem, not a quick workaround that might prove to be
    just as faulty as the original solution. Especially since this
    involves passwords giving access to personal information.

    In this particular case, I would opt for an encoding of the
    passwords that ensures that no character or substring in the
    encoded password collides with a record separator. Encryption
    would be even better.


    --
    Andreas Kähäri
    Andreas Kahari Guest

  11. #10

    Default Re: split() matching regular expression question - openwebmail bug...

    Bart van den Burg (bart-news@NOSPAMtvreclames.nl) wrote on MMMDCLXIII
    September MCMXCIII in <URL:news:bjqmsu$6nd$1@reader11.wxs.nl>:
    &&
    && Because that's hard to do if it's in a web environment, cause if you press
    && [tab], you'll go to the next input box. Ok, you could go and copy/paste one,
    && but would you really wanna do that everytime you wanna login there?


    Don't make the newbie mistake of "if it works on my browser, it will
    work anywhere". While tabs might go to the next field in some browsers,
    it won't in others. And yet another set of browsers allow tabs to be
    escaped.

    Not that this has anything to do at all with Perl.


    Abigail
    --
    package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
    print } sub __PACKAGE__ { &
    print ( __PACKAGE__)} &
    __PACKAGE__
    ( )
    Abigail Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139