w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Correct permissions to write file to disk inside SharePoint's EventReceiver
Use SPSecurity.RunWithElevatedPrivileges for all disk operations because incoming user is unlikely to have permissions to write anything to server's file system. SPSecurity.RunWithElevatedPrivileges(delegate() { // open/write/close file here. // Avoid touching SPxxxx objects from outside of this delegate });

Categories : C#

NTFS vs. File Share
Short answer: No. In Windows each file and directory has an ACL controlling access to it. Each file share also has an ACL controlling access to the share. When you access a remote file through a share you are doing so using the credentials used to login to the local computer. (You can connect using different credentials by entering a username/password when connecting). The remote computer tests the supplied credentials against the ACL on the share. Once you are past that, then every file you attempt to access on the remote machine through this connection will be checked using your credentials against the ACL on the file and the share. This allows a file share to offer more restricted access to some files than if the same user were attempt to access them locally. (So you could share file

Categories : Misc

NTFS - file record size
It's not actually that much of a waste. You should try to look at what happens when the number of attributes stored in the file record exceeds 1 KB. (by adding additional file names, streams, etc.) It is not clear (to me at least) for different versions of NTFS if the additional attributes are stored in the data section of the volume or in another File Record. In previous versions of NTFS the size of a MFT File Record was equal to the size of a cluster (generally 4KB) which was a waste of space since sometimes all the attributes would take less than 1 KB of space. Since NT 5.0 (I may be wrong), after some research, Microsoft decided that all MFT File Records should be 1KB. So, one reason for storing that number may be backwards compatibility. Imagine you found an old hard drive which stil

Categories : File

Viewing Ciphertext of Encrypted File on NTFS (EFS)
The way you open an encrypted file in order to read its raw encrypted contents (e.g. for a backup/restore application) is to use the: OpenEncryptedFileRaw, ReadEncryptedFileRaw, WriteEncryptedFileRaw, and CloseEncryptedFileRaw api functions. Writing the code on the fly, in a hypothetical hybrid language: void ExportEncryptedFileToStream(String filename, Stream targetStream) { Pointer context; res = OpenEncryptedFileRaw("C:UsersIanwallet.dat", 0, ref context); if (res <> ERROR_SUCCESS) RaiseWin32Error(res); try { res = ReadEncryptedFileRaw(exportCallback, null, context); if (res != ERROR_SUCCESS) RaiseWin32Error(res); } finally { CloseEncryptedFileRaw(context) } } function ExportCallback(pbData: PBYTE, pvCallbackCo

Categories : Windows

How does NTFS handle the conflict of short file names?
NTFS won't create two short names like that. The first will be THISIS~1.txt and the second will be THISIS~2.txt. For example, open a command prompt and from the root of C: drive type C:>dir prog* /x /ad<Enter> On a Windows 7 64-bit system you will see output similar to this 03/28/2013 12:24 PM <DIR> PROGRA~1 Program Files 07/31/2013 11:09 AM <DIR> PROGRA~2 Program Files (x86) 12/10/2012 05:30 PM <DIR> PROGRA~3 ProgramData

Categories : Windows

NTFS sparse file data runs ($UsnJrnl)
No, it means that $UsnJrnl occupies 2576 clusters on disk. Sparse clusters don't occupy any space on disk, if you'd try to read sparse cluster, e.g. cluster 10 in your example, NTFS just returns zeros. Generally, you can't determine start and end cluster of the file, since files can be fragmented - your example says that first 1408 clusters are not allocated on disk at all, then 128 clusters of that file occupy disk clusters 510119 - 510247, then 2448 clusters of the file occupy disk clusters 256 - 2704; so in this case you can't say that file begins by cluster X (on disk) and ends by cluster Y (on disk) - it's possible only if file is not fragmented (when it uses only one cluster run).

Categories : Windows

C - How do I move a file from a cifs mount to local hdd
In all likelihood, if you interrogate errno after rename fails, you will find that it is set to EXDEV. May I suggest that you add that information or confirm that it is EXDEV. If you are getting EXDEV, then it is because of the Linux limitation that rename() only works if oldpath and newpath are on the same mounted file system. From rename(2) EXDEV oldpath and newpath are not on the same mounted file system. (Linux permits a file system to be mounted at multiple points, but rename() does not work across different mount points, even if the same file system is mounted on both.)

Categories : C

Android Facebook native app not getting user email and birthday even with permissions set and correct information in fields
When you are using Request.GraphUserCallback(), its best to use it in MAIN UI THREAD Session s = Session.getActiveSession(); if(s!=null) { Request.executeMeRequestAsync(s,new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { if(user!=null) { try { String fbid=null; String birthday=null; fbid=user.getId(); birthday=user.getBirthday(); } catch (JSONException e1) { e1.printStackTrace(); } } } }); }

Categories : Android

Correct option to fix ARC casting error
You have no need to transfer ownership of the _fontName reference so you should use: _font = CTFontCreateWithName((__bridge CFStringRef)_fontName, fontSize, NULL);

Categories : Iphone

BigCommerce API - What is correct resource for updating an option value
Basically, if you do a GET request on options { "id": 3, "name": "Colors", "display_name": "Color", "type": "CS", "values": { "url": "https://store-xxx.mybigcommerce.com/api/v2/options/3/values.json", "resource": "/options/3/values" } } The resource endpoint shows that the URL is options/id/values.json. But, this gives you all the values associated with the option. If you want to retrieve a specific option the endpoint is something similar to /api/v2/options/3/values/7.json { "id": 7, "option_id": 3, "label": "Silver", "sort_order": 1, "value": "#cccccc" } Doing a PUT request on this - (On REST console, setting the header content-type to application/json and sending raw JSON data) updates th

Categories : Api

strftime not giving correct output with %C option - Solaris 10
Have a good look at the code between call to strftime() and printing curr_date. You're overwriting curr_data somewhere, because the start of what you print is correct. Might also be something fishy with memory management of curr_data; how is it defined, did you allocate memory for curr_data? Set a breakpoint right after strftime() and you'll see it holds the expected/correct string.

Categories : C

How to get to last NTFS MFT record?
The MFT location isn't always fixed on the volume. You should get the starting MFT offset from the boot sector (sector 0 of the volume, you can find the structure online). The first file in the MFT is the "$MFT" file which is the file record for the entire MFT itself. You can parse the attributes of this file like any other file and get it's data run list. When you know the size of each fragment in clusters, parse the last cluster for each 1024 byte record of the last fragment (although I believe a fragmented MFT is rare). The last record in the MFT is the last record in that particular cluster marked "FILE0", if you encounter a null magic number that would be 1024 bytes too far. Or you can just get the file size from it's attributes and calculate the offset to the end of the MFT based o

Categories : Windows

opencart: check if product has an option named 'pack' and if so correct the price
Yeah you should reconfigure the pack price option to subtract 4,40 instead of adding 66 Then remove that added code and set it back to the original. Product options will natively either add or subtract from the base price without any modifications to the code. That should do the trick for you.

Categories : PHP

comparison of selected option with correct answer in a group of radio buttons
You can add an ActionListener to each button in which you can set, for example, class field to currently selected radio button value. ... String firstAnswer; String secondAnswer; ... private FirstQuestionActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { firstAnswer = e.getActionCommand(); } } private SecondQuestionActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { secondAnswer = e.getActionCommand(); } } And use it this way: rb1.addActionListener(new FirstQuestionActionListener());

Categories : Java

How do I get the checkbox "Allow access to file URLs" to show up next to my app? I have file write permissions in manifest
To get this to work you need either: permissions: [ "<all_urls>" ] or a scheme starting with file:///. If you try *://*/* that will not work as it only represents http or https

Categories : Google Chrome

NTFS Journal USN_REASON_HARD_LINK_CHANGE event
As always with the USN, I expect you'll need to go through a bit of trial and error to get it to work right. These observations/guesses may, I hope, be helpful: When the last hard link to a file is deleted, the file is deleted; so if the last hard link has been removed you should see USN_REASON_FILE_DELETE instead of USN_REASON_HARD_LINK_CHANGE. I believe that each reference number refers to a file (or directory, but NTFS doesn't support multiple hard links to directories AFAIK) rather than to a hard link. So immediately after the event is recorded, at least, the file reference number should still be valid, and point to another name for the file. If the file still exists, you can look it up by reference number and use FindFirstFileNameW and friends to find the current links. Comparin

Categories : Windows

What is the difference between HDFS and NTFS and FAT32?
... Because NTFS and FAT aren't Distributed. The advantage of HDFS is that it is. See the HDFS Introduction.

Categories : Hadoop

FBSession.activeSession.permissions does not appear to accurately depict the valid granted permissions
If you were using iOS SDK 3.0, then this was due to a bug in the SDK. See the bug report for more details. Symptom summary: After authorizing user with openActiveSessionWithPermissions method, the sessions variable in callback method contains extended permissions that were not allowed by a user.

Categories : IOS

access to ntfs stream for a very long filename fails
As the very helpful page on CreateFile says referring to the lpFileName parameter which specifies the filename: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "?" to the path. Since you are contemplating BackupRead obviously you are wanting to access this stream programatically. If so, test things programatically. Trying all these operations from the command prompt is a crap-shoot and will not establish anything more than the ability to perform such operations from the command prompt. With that in mind, let's try this simple program - boilerplate code removed: #include "stdafx.h" int APIENTRY _tWinMain(HINSTANCE, HINSTAN

Categories : Windows

How to make Gradle stop trying to chmod MANIFEST.MF on an NTFS drive
Gradle is trying to set default permissions for that file, and I can't see a way to stop it from doing that. (You could make it set different permissions, but I guess that won't help.) Under Windows/NTFS this normally works just fine, so it might be a problem with you Linux NTFS driver or configuration.

Categories : Linux

Create a symbolic link (or other NTFS reparse point) in Windows Driver
There isn't direct API to create reparse points. You need to use ZwFsControlFileZwFsControlFile() to send FSCTL_SET_REPARSE_POINT ioctl with appropriate input buffers and parameters. Don't have example though!

Categories : Windows

copy OSX file with permissions
you can use cp -p -p Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved.

Categories : Osx

Google API file permissions
I was never able to set up Google and Ubuntu to allow me to run the Google custom search client from multiple users, so I created a workaround. :) I set up a web page under apache that calls each of the search scripts I wanted to run. Any user must use the web page to run the script. That way all searches run under the www-data user id. I just have to be careful not to try to run the custom search client any other way (from the command line).

Categories : PHP

Directory permissions to a php file
try this <?php chmod("/somedir/somefile", 755); // decimal; probably incorrect chmod("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect chmod("/somedir/somefile", 0755); // octal; correct value of mode ?> here /somedir/somefile is your file path and read this article

Categories : PHP

Changing permissions on a file
The only people that can change the permissions of files are the people that own the files (in your case, jim) and the root user. This is to prevent users from doing something malicious, like changing the permission of someone else's file to r/w and then deleting everything in the file, or something similar.

Categories : Linux

File permissions are not being preserved while after zip
It looks like you will need to try a different archive format. Perhaps tar --preserve-permissions. The other option would be to save the permissions separately and the reapply them upon decompression. You could add a .saved_permissions file to the archive. There are some examples of scripts that can do this on StackOverflow.

Categories : Java

File permissions and security
That depends. To modify the file, an attacker must be able to execute some kind of code on the server, e.g. have shell access. If this is the case, the permission is your smallest problem. If you are on a shared hosting environment (other customers you don't know use your webserver) these other users possibly can change the file too, if your provider did not setup their security right and they know the path. It is just not considered best practice to set 666 permissions. However most of these kind of attacks happen over your webserver, so restriscting the permission do not solve the problem, as the server needs to have write access. So what you can do: Change the mode to 664 and change the group to that of the webserver is running in - other users may still have write access by using t

Categories : File

Get value from the user selected option on select option element and update the input form based on chosen option
You'll need to get the value of the selected option inside your handler, otherwise the variable won't be updated with the current value. Also, jQuery selectors are case sensitive, so you'll need to use #Reason not #reason. This should work for you: $('#Reason').on('change', function(){ var selectedOption = $(this).find("option:selected").text(); alert(selectedOption); }); Working Demo

Categories : Jquery

set file permissions in one directory to match another
It could be easy as using get/setfacl (check the generated file has relative paths): cd dir-a && getfacl -R . > /permissions.acl cd dir-b && setfacl --restore=/permissions.acl

Categories : Python

permissions issue accessing a file
Just because you have the rights to read a file doesn't mean you can actually REACH that file. You need permissions to access all of the parent directories of wherever that file is. Consider it the equivalent of giving you permissions take a $1 bill from me, but that $1 bill is inside a safety deposit box in a bank's vault. You have the rights to the money, but no rights to walk into the vault and open the box.

Categories : Linux

NSIS batch file permissions
Is the NSIS installer being ran with administrator permissions? If so, any process that the installer starts will also have administrator permissions. Check out Ander's answer on how to request admin rights for your installer: http://stackoverflow.com/a/8735349/1030416

Categories : Batch File

How can I copy permissions from a file that already exists?
The stat() and fstat() functions retrieve a struct stat, which includes a member st_mode indicating the file mode, where the permissions are stored. You can pass this value to chmod() or fchmod() after masking out the non-file-permission bits: struct stat st; if (stat(file1, &st)) { perror("stat"); } else { if (chmod(file2, st.st_mode & 07777)) { perror("chmod"); } }

Categories : C

How to get file ownership and permissions in android
You can create a Process object and execute the command. You could append the path of the File object as parameter. After that you can read the result from the InputStream. Please comment if you need an example.

Categories : Java

Remove all default file permissions
Impersonation may be help you to solve this out. The term "Impersonation" in a programming context refers to a technique that executes the code under another user context than the user who originally started an application, i.e. the user context is temporarily changed once or multiple times during the execution of an application. click Here to see implimentation

Categories : C#

Getting/Setting File Permissions From Rebol
At the moment, no, you have to use call. It is planned to add back the port mode getting and setting capabilities, but the API needs a revamp first and we haven't started the discussion for that yet. The port model is mostly different in Rebol 3, so the port mode model is going to have to be different too. Feel free to get the discussion started.

Categories : Misc

Checking file access permissions for specified user in C / *nix
setuid() sets the real and effective user ID of the process, but does not modify the group access list, for that you have to call setgid(), initgroups() or setgroups(). So your program runs with the used ID 1002 and with the original group ID and group access list, and not with the group access list of the user 1002. That explains why the process does not have read permission to the directory. Note that access() is considered a "security hole", (see for example access() Security Hole). It is generally better just to try to open a file or directory instead of checking the read permissions beforehand.

Categories : C

Change permissions of file in the download folder
Some file systems including SD cards do not allow permission changes. The generic download folder most probably is on one of that kind. Try changing the USB computer connection to Mass storage, that should fix the problem.

Categories : Android

Apache server file permissions and url accessibility
Maybe you could add the user that is running apache / php to the group that owns the file. And set config to read and write for owner and owner group, and no permission at all for others. (-rwxrw---- 0r 0760) Never tested it, but it should work.

Categories : PHP

compare windows file (or folder) permissions
You cannot use Equals() since this method is inherited from Object. You need to find a identifying attribute on that DirectorySecurity class. I think String GetSecurityDescriptorSddlForm() should do your job. You can invoke Equals() on that. Edit: Well sorry, this method needs a parameter for invocation. Try finding another attribute on the DirectorySecurity which is better for comparison. Edit2: I'm not familar with .NET Security Framework and Right-Management, but something like this should be your approach. You can do != resp: == on FileSystemAccessRule.FileSystemRights because that attribute is an enum (internally an int). ArrayList notIdenticalList = new ArrayList(); DirectorySecurity parentFolderAccessControl = Directory.GetAccessControl(null); DirectoryS

Categories : C#

How to write a file with the permissions of the owner in perl
You can run 'chown' to changes the owner (and group) of a list of files in perl. Example: #!/usr/bin/perl $cnt = chown $uid, $gid, 'foo', 'bar'; chown $uid, $gid, @filenames;

Categories : Perl



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.