Re: ssh-keygen: error if file is directory

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Salar Nosrati-Ershad wrote:
> On several tasks if you pass a directory as a file to ssh-keygen, the
> program wouldn't check the file mode to check if it's a directory like:
> `Saving key "./test/" failed: Is a directory`
> After asking the user to overwrite or not.

Seems an appropriate error message is emitted to the caller if the
argument is of an incorrect type.  It's good.  Right?

> The file mode is already readed when getting `stat`
> Do you think checking it is a good idea?

My opinion is that this is not a good thing to do.  Going down that
route eventually leads to a lot of unnecessary code bloat chasing all
of the types of anything that is not a file.

There is already an appropriate error message printed.  Why isn't that
good enough?

Why is the caller passing a directory intead of a file?

Just as a discussion point, what if someone else comes along and says,
hey if someone passes a Unix domain socket path to the program and
asks if there should be an explicit test for that type?  And then
someone else says what if someone passes a block device?  And then
someone what about a character device?  And what if...  You get the
idea.  This type of chase just keeps chasing different types.

The message saying that the save failed and the error as to why feels
perfect to me and I have no idea why that would not be understood
already.

Bob
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux