|
|
#1 |
|
Junior Member
Join Date: May 2007
Posts: 36
|
IP Address verification
Hello everybody,
I have read the validate IP function, usage but i was unable figure out how can installer get the user IP address for validation. Thanks, Veeru |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Use ValidateIP.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: May 2007
Posts: 36
|
Quote:
Thanks. |
|
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Why would you want to validate the user's IP? It can't be invalid if you get it through the API.
To get the IP, use one of the following: http://nsis.sourceforge.net/IP_plug-in http://nsis.sourceforge.net/Internet_plug-in NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: May 2007
Posts: 36
|
[QUOTE]Originally posted by kichik
[B]Why would you want to validate the user's IP? Can you please explain me about following statement in depth "It can't be invalid if you get it through the API". Thanks lot. |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: May 2007
Posts: 36
|
[QUOTE]Originally posted by kichik
[B]Why would you want to validate the user's IP? It can't be invalid if you get it through the API. Here i am thinking to give access to installers for the users within our domain and to abort the process if user is not within valid domain range. Please present your comments on the above thought. Thanks.. |
|
|
|
|
|
#7 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
The ValidateIP function only checks to make sure a given string is a valid IP. It doesn't check for ranges. If you get the string from a good place (e.g. API), there's no need to validate it.
To make sure the IP is within a given subnet, you'd probably want to split using WordFind, as in ValidateIP, and use IntCmp on each part to make sure it's within the wanted range. You could also convert the IP to a 32-bit integer and use good old masking with IntOp. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|