473,789 Members | 2,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

read users permissions on files in the local network

20 New Member
please i need you'r help .. we are designing a web site and we need a critical code in php for security , we have to read users permissions on files in the local network ,to give them the real access and permissions also in their homes(on website) not just in thier work place (by local network security)so we have to read ldap file system ,but we can't find the code required ........
Jun 5 '07
22 2763
hamarsheh
20 New Member
this error msg appears befor i added debugging msg .

Can't contact LDAP server

although the connect function returns true .
i installed openldap server and determined cn , ou , and all required information and i executed my code while that server was running , the same result , i dont know what i have to do , is ldap supported automatically and i only connect to it or there must be some program installed inaddtion to the configurations i did ,?
Jun 11 '07 #11
hamarsheh
20 New Member
i found something about ldap support in php but i don't understand what i have to do , what i have to do with the dark lines below ...

LDAP support in PHP is not enabled by default. You will need to use the --with-ldap[=DIR] configuration option when compiling PHP to enable LDAP support. DIR is the LDAP base install directory. To enable SASL support, be sure --with-ldap-sasl[=DIR] is used, and that sasl.h exists on the system.
Jun 11 '07 #12
Motoma
3,237 Recognized Expert Specialist
the following was displayed:

Warning: mysql_query(): supplied resource is not a valid MySQL-Link resource in C:\AppServ\www\ test.php on line 23

--------------------------------------------------------------------------------
MySQL Error:


and my php code[apiece of it] :
Expand|Select|Wrap|Line Numbers
  1. if(!($ldap=ldap_connect("aham@bir.edu"))){
  2.  die("ldap server can not be reached");
  3.  }
  4.  else{
  5. $oudc="ou=birzeit,dc=bzu";
  6. $dn2="cn=aham,".$oudc;
  7. $password="all";
  8.  
  9.  
  10. if(!($res=@ldap_bind($ldap,$dn2,$password))){
  11. mysql_query($res, $ldap) or die('<hr />MySQL Error: ' .mysql_error(). '<hr />');
  12. print(ldap_error($ldap)."<br>");
  13. die("could not bind to $dn2");
  14.  
  15. }
  16.  
the function mysql_query requires aquery identifier ididn't do anything till now, all i did just bind so i gave the function $res which is the bind return value, i really don't know if this is the problem .
the problem i'am facing is that its the first time i deal with ldap !!!...

Also, if i put any thing in the ldap_connect function it returns true..
The error is occuring with your MySQL statement. What exactly are you trying to do on that line?
Jun 11 '07 #13
Motoma
3,237 Recognized Expert Specialist
i found something about ldap support in php but i don't understand what i have to do , what i have to do with the dark lines below ...

LDAP support in PHP is not enabled by default. You will need to use the --with-ldap[=DIR] configuration option when compiling PHP to enable LDAP support. DIR is the LDAP base install directory. To enable SASL support, be sure --with-ldap-sasl[=DIR] is used, and that sasl.h exists on the system.
Run a phpinfo page, and see if LDAP is enabled on your server. If it was not, ldap_connect() would give you an error along the lines of "Function does not exist."
Jun 11 '07 #14
hamarsheh
20 New Member
thanks alot motoma ...

i got all users from ldap there was an error on our organizational unit .
Now what i want to do is to read users permissions i now need to get the file group id , i can do it using the function int filegroup ( string $filename )

which returns the group ID of the file, . The group ID is returned in numerical format,so you have to use posix_getgrgid( ) to resolve it to a group name.
but unfortunately the last one(posix_getid ( )) is only defined on unix platform , i'am searching for afunction defined on windows to do this task ..
OR if i can work on windows and use unix help at same time , idon't know if there is away to do that.
Jun 14 '07 #15
Motoma
3,237 Recognized Expert Specialist
Why do you need to resolve the group id to a group name? It has been a long time since I have dealt with LDAP, but isn't this something you could do with the LDAP functions PHP provides?
Jun 14 '07 #16
hamarsheh
20 New Member
because the function dosen't produce meaningful results on windows system, there is afunction which resolves this , but unfortunately its only defined on unix platforms . this is the problem i'am facing , i looked for functions that can do the same thing and defined on windows but i didn't find any one all sites give you the same function which works only on unix.......
Jun 16 '07 #17
Motoma
3,237 Recognized Expert Specialist
because the function dosen't produce meaningful results on windows system, there is afunction which resolves this , but unfortunately its only defined on unix platforms . this is the problem i'am facing , i looked for functions that can do the same thing and defined on windows but i didn't find any one all sites give you the same function which works only on unix.......
Have you played around with LDAP Browser at all? The reason I ask is because it is a very useful tool to use side by side with LDAP programming. It will show you all of the information you will be able to query from your LDAP server.

I guess, to rephrase my question: what do you need a group name for what a group id will not suffice?
Jun 16 '07 #18
hamarsheh
20 New Member
may be i didn't give the complete picture about what we are infact doing ..
we are designing aweb site , we have a local network in our company , on the local network users have permissions on folders they can't open every thing , what we need is to reflect this on our website there are links on the website which uses these folders
the steps are : we need to get all groups from the ldap , then to get users of each group , so when auser login we can determine in which group he is , then we need to read file permission or( which group uses) each file , now user permissions are determined..
you may say why this effort users can reach folders in local network server , thats right but we are looking for making it also available in their homes ...
i hope that the idea is clear now ..
i read all users from ldap but i'am looking for getting groups from ldap , and reading files permissions ..
i will seek for ldap browser
thank you
Jun 18 '07 #19
Motoma
3,237 Recognized Expert Specialist
The point I was trying to get at is that a file's group ownership is represented by a number, and a user's group membership is represented by a number, why does one need to resolve this number to a name in order to do the comparison?
Jun 18 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2471
by: TechBoy | last post by:
RE: Access 2002 SP3 I have an app "App1.mdb" that has internal security built-in via a table: tblSecurity. In this table a match is obtained to see if they are authorized to use the app. This application has no Jet security being used ("Users/Groups", etc.) One of the requirements was to hide the DBWindow completely from the users, which works fine and the DBwindow is secure from all users. Another requirement for App1.mdb: the users...
12
1975
by: Mark | last post by:
Hello, in a simple console application I try to create a file with some code like: FileStream file = new FileStream("test.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new StreamWriter(file); sw.Write("Hello"); sw.Close(); file.Close();
2
3373
by: Rick Strahl [MVP] | last post by:
I'm having problems with installation of a Web app on my Win 2003 server. I copy up the app configure the virtual. But when I access any ASPX pages I now get: CS0016: Could not write to output file 'd:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\company_mywebapp\e792bb5e\ed91474e\nupdhhtj.dll' -- 'Access is denied. '
2
3934
by: Michal Valent | last post by:
Hello, if I try to read a file on the mapped network drive, this error apears: Logon failure: unknown user name or bad password. How to set up permissions for IUSR_MACHINENAME on the mapped network drive? Thaks
5
13305
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a number of search folders using the standard dialog control. There shouldn't be an issue with the search folder being on a local drive or a network drive. But if you don't have Read access to the folder, there's trouble. The user can see the...
3
4824
by: James Maeding | last post by:
I am familiar with using My.Computer.FileSystem.GetDirectoryInfo to get folder attributes, see code below... This does not work though for network drives on my companies system. We use windows as our server, nothing exotic. I looked at the security permissions and the "write" box for domain users was grey, but not checked. This means read-only to me and sure enough, I cannot change the files. Is there a different way to deal with...
2
10696
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data not allowed. This is done so that users cannot take away a copy of the .exe file. When I execute the ..exe from the client computer I get .Net Framework Initialization Error, Unable to find a version of the runtime to run this application. The...
8
3873
by: paquer | last post by:
Database Users need to have Read/Write etc... permissions to the folder where the Database resides in order to create the lock file. I have read only users. I have set up the Shortcut that links to the 'Workgroup Info File' with permissions for said database. Within this 'WIF' File I have "Read Only" user's who are only provided access to the DB only so they can view the data. Now if I give them full permissions to the folder where...
7
1454
by: =?Utf-8?B?SmVmZkRvdE5ldA==?= | last post by:
I have an asp.net application using a multi-page wizard control that grabs user selected files from a database and allows the user to configure parameters using controls on the wizard pages. The resultant files are then submitted for simulations. When I attempt to navigate through the wizard an exception is thrown because I am not permitted to overwrite a file in a read-only directory. When I uncheck the read-only on the folder...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.